Highlight Text Patterns

Overview

Highlight Text Patterns scans text on selected pages and applies markup annotations wherever your patterns match. You can highlight, underline, cross-out, or squiggle-underline the matched text, with full control over colours, pattern types, and page scope. After each run a summary reports how many annotations were added and on how many pages.

Video: Highlight Text Patterns shown step by step, with narration.
The Highlight Text Patterns dialog
The Highlight Text Patterns dialog.
The Edit Pattern dialog
The Edit Pattern dialog.

How to use

  1. Open a PDF document.
  2. Go to Plug-Ins > Highlights > Highlight Text Patterns.
  3. Build your pattern list: click From Library... to add a ready-made pattern by name (postcodes, e-mail addresses, dates, and more), or Add Custom... to write your own.
  4. Select the annotation type and choose how matches are coloured.
  5. Set the pages to process.
  6. Click OK to apply the annotations.

The pattern list

Each row in the list is one pattern with its own name, matching type, and (optionally) its own colour. Untick a row's checkbox to skip it without deleting it. Double-click a row to edit it. The row order matters when the "different colour for each pattern" option is on.

A row can also carry a pop-up note, loaded with Tooltips CSV.... The note becomes the text of the pop-up note on every annotation the row creates. A row without a note uses its name, or Pattern: followed by the pattern. While any row has a note, a Note column shows it.

ButtonDescription
From Library... Adds a pattern from the regular expression library. The library entry's name (e.g. "UK Postcodes") is kept, appears in the list, and is shown in the annotation's popup note instead of the raw expression.
Add Custom... Opens the pattern editor to write your own pattern: give it a name, choose how it is interpreted, optionally give it a colour, and try it against sample text before saving.
Edit... / Remove / Move Up / Move Down Change, delete, or reorder the selected row.
Tooltips CSV... Loads a CSV file of search terms and pop-up notes. The first row is treated as a header and skipped; each row after it is term, note, optionally followed by a #RRGGBB color. A row with no comma (a term without a note) is ignored, and if a term appears more than once, its first row is used.
  • Each row in the list whose pattern is exactly one of the terms (capitals included) gets that term's note, and its color as well if the row has no color of its own.
  • Each other term is added to the list as a literal-text row with its note and color.
  • Rows the file does not mention are left as they are. A term listed with an empty note removes the note from its rows.
The notes and colors are saved with the rows, in your settings and in named configurations, so every later run uses them. A message reports how many terms were read, how many rows were added, and how many rows already in the list had their note or color changed.

Pattern types

Each pattern row is interpreted per its own type, chosen in the editor:

TypeDescription
Literal text Matches the exact text of the pattern.
Wildcards (* ?) Uses * for any run of characters within a word and ? for a single character. Wildcards never reach across a space, so invoice* highlights “invoice”, “invoices” and “invoice-2024”, not the rest of the line. Use a regular expression to match across words.
Regular expression Uses C++ ECMAScript regular expression syntax for advanced matching. Library patterns are always regular expressions.

Options

OptionDescription
Case sensitive When checked, uppercase and lowercase letters must match exactly.
Whole words Only matches complete words, not substrings within longer words.
Visible text only Ignores text on layers (optional content) that are currently hidden. Text hidden in other ways, such as white or covered text, is still matched.
Annotation The markup style: Highlight, Cross-out, Underline, or Squiggle.
Skip overlapping annotations Skips a match if it would overlap an existing highlight, underline, cross-out or squiggle on the same line of text. Annotations on the lines above and below do not count.
Remove this tool's previous annotations first Deletes every highlight, underline, cross-out and squiggle this tool created on the selected pages (whatever type you choose now), with their pop-up notes, before applying new ones.

Colour

OptionDescription
Single colour One colour of your choice for every match.
One of your saved highlight colours Pick one of the colour presets saved in the Annotation Highlights toolbar (managed under Preferences > Highlights). The drop-down shows each preset's swatch and name.
Different colour for each pattern Each pattern row gets the next saved highlight colour in turn, so every pattern stands out differently. Rows keep their colours stable: a row with its own explicit colour keeps it and does not consume one of the rotating colours.

A color set on the row itself always wins over the option chosen here. A Tooltips CSV color is stored as the row's own color when the row has none, so it shows in the list's Colour column and is saved with the row; a row that already has its own color keeps it.

Pages

OptionDescription
All pages Processes the whole document (the default).
Current page Processes only the active page. The label shows which page that is, e.g. "Current page (3 of 11)".
Pages from / to Processes a range of pages (1-based). Check To end of document to run from the start page to the last page.
Custom range Lists the exact pages, e.g. 1-3, 7, 10-12.
Subset Restricts any of the above to odd or even pages (by document position, not page label). Useful for double-sided material.

Tip

The pattern editor's Try it box checks your pattern as you type: paste a sample of the document text into it and the editor tells you whether the pattern matches before you run anything. It applies the Case sensitive and Whole words options as they were set when you opened the editor.

Note

All dialog settings, including each row's note and color, are remembered between sessions. To save them as a named configuration, type a name in the Configurations box and press Enter or click Save (you are asked before a configuration of the same name is replaced); choose a name from the list to load it again. To rename a saved configuration, choose it from the list, type the new name over it and click Rename. While the list is open, Enter loads the highlighted configuration, and with the box empty, Enter is the same as OK. Pattern lists saved by older versions (one pattern per line, with ; comments and #RRGGBB: colour prefixes) are converted to list rows automatically the first time this version opens.

See also