Create Links by Text Search

Overview

Create Links by Text Search turns text that matches regular-expression rules into live link annotations — page references become GoTo links, URLs and e-mail addresses become web links, and any match can trigger JavaScript. Rules are built and previewed in one dialog, so you see exactly which text will be linked before anything is written into the document.

Video: Create Links by Text Search shown step by step, with narration.
The Create Links by Text Search dialog, Library tab
The Create Links by Text Search dialog, Library tab.
The Create Links by Text Search dialog, Rules tab
The Create Links by Text Search dialog, Rules tab.
The Create Links by Text Search dialog, Preview tab
The Create Links by Text Search dialog, Preview tab.

How to use

  1. Open the PDF and go to Plug-Ins > Links > Create Links by Text Search.
  2. On the Library tab, pick a saved pattern and click Add to Rules — or switch to the Rules tab and write your own.
  3. For each rule set the Pattern, matching flags, an optional Context expression, the Action, and its values.
  4. Check the Preview tab: it runs the enabled rules on one page — the page you were viewing, or the first page of the selected rule's page range — and lists each link they would create there and what it will do, with the captured text filled in: for example Go to page 12 or Open web link https://example.com/12.
  5. Click Generate.

Options

OptionDescription
Library tab Patterns from the shared Regular Expression Library, filterable by keyword and group; "Require captures" shows only patterns with capture groups. Add a pattern to the rules or copy it to build on.
Rule list Rules run in order; New / Duplicate / Delete / Up / Down manage them, and Enabled turns one off without deleting it.
Pattern + flags The regular expression to match, with case-insensitive (i), multiline (m, see below), flexible-spacing (x: each space in the pattern matches any run of whitespace; spaces are not ignored) and typographic-punctuation (u: straight quotes also match curly quotes, and a hyphen also matches en and em dashes) flags. Every occurrence on each page is linked (the global flag is always on). Validate checks the expression before use.
m (multiline) Without m, each page is searched as one line of text: the end of each line reads as a space, so a phrase that wraps onto the next line still matches, and ^ and $ match only at the start and end of the page. With m ticked, the page keeps its line breaks: ^ and $ also match at the start and end of each line, so ^\d+\. links the number at the start of every numbered line. A line break then does not read as a space: . never matches it, a space in the pattern matches it only when x is ticked, and \s always does. The Context expression is searched the same way. Captured text that runs across a line break goes into the action's values with a space in place of the break.
Context A second expression that must also be found on the same page — anywhere on that page, not only next to the match. Nothing is linked on a page where it is not found. To link "42" only where it reads "see page 42", put the words in the pattern instead, for example see page (\d+) with \1 as the page; the link then covers the whole phrase.
Action + values What the link does: go to a page in this document (by number or by page label), a named destination, or a page in another PDF or in an attachment; open a web address or a file; run JavaScript; or run an Acrobat menu item by name (for example NextPage). The value fields take the target, and can use capture groups from the pattern.
Limit to page range Restrict the search to part of the document.
Try it Run Test matches the pattern against the sample text and lists each match and its captured groups. Load Page Text fills the sample with the text of the page you were viewing, line by line, exactly as Generate reads it. Run Test reads each line break in the sample as a space unless m is ticked, as Generate does. It tests the pattern only: the Context expression and the page range are not applied.

Created links are invisible (no border). A link to a page opens it at the top-left of the page at the viewer's current zoom. A match that wraps onto a second line is one link whose live area covers just the matched words on each line. Words set apart by spacing rather than a space character are treated as separate words, so a pattern containing a space matches them.

Warning

This engine does not support inline flags such as (?i) — use the case-insensitive checkbox instead — or look-behind assertions.

Tip

Keep frequently used patterns in the Regular Expression Library; the Library tab reads it live, so a pattern fixed once is fixed for every rule that uses it.

See also