Split by Pattern Change

Overview

Split by Pattern Change applies a regular expression to the full text of each page and extracts the first capture group. Whenever the captured value changes from one page to the next, a split point is created. This gives fine-grained control over what is compared — for example, extracting only the numeric part of a document code and splitting when that number changes.

Video: Split by Pattern Change shown step by step, with narration.
The Split by Pattern Change dialog
The Split by Pattern Change dialog.

Note

The dialog remembers the settings it last ran with (never the passwords), and an empty output folder starts as the folder of the open PDF. Browse... opens at the folder already typed.

Security... reads Security (on)... while password security is switched on for the output files, for example after you choose a configuration or load a profile that sets passwords.

How to use

  1. Open the PDF you want to split.
  2. Go to Plug-Ins > Split > Split by Pattern Change.
  3. Enter a regular expression (optionally using the regex library).
  4. Choose whether to split at each value change or combine pages with the same value.
  5. Set the output folder and file pattern, then click OK.

Options

OptionDescription
Regular expression A standard C++ std::regex (ECMAScript syntax) applied to the full text of each page. The value used for comparison is the text of the first capture group if the pattern contains parentheses (e.g. Invoice #(\d+) captures just the number), or the entire match if there are no capture groups. A page where the pattern does not match keeps the value of the page before it, so it stays in the same file; only pages before the first match have no value. If no page matches, nothing is written.
Regex Library Click the Regex Library button to open a library of saved regular expression patterns. Selecting a pattern from the library inserts it into the regular expression field.
Split at captured value change A new output file begins each time the captured value differs from the previous page's value. Consecutive pages with the same value are placed in the same file. This is the default mode.
Combine pages with same capture All pages sharing the same captured value (including non-contiguous pages) are merged into one output file named after the captured value.
Output folder The folder where output files are saved. Click Browse to choose a folder.
File pattern Controls the output filename. Default is output_{n}. When you choose Combine pages with same capture while the pattern is still output_{n}, it becomes {n}_{tag}, so each file is named after its captured value; choosing Split at captured value change changes {n}_{tag} back to output_{n}. Any other pattern is left as it is, and loading a configuration or profile never changes the pattern it brings. Available tokens:
TokenReplaced with
{n}Sequential 1-based index
{value} or {tag}Captured text value
OptionDescription
Open output files after creation Opens each generated file in Acrobat after the operation completes.

Tip

Use the Regex Library button to quickly select common patterns without having to write the regular expression from scratch.

Note

This command differs from Split by Text Pattern in that it compares the extracted value page-by-page rather than simply detecting the presence of a match. Use this when you need to detect changes in a value rather than just the existence of a pattern.

See also