Skip to content

Save finds and search with patterns

Search with patterns (regular expressions), reuse parts of a match in the replacement, and save a find to run again in any book.

Search with a pattern

  1. Open the Find and replace panel with Ctrl+F.
  2. Check Pattern.
  3. Type a regular expression in Find, for example \d+ for any number.
  4. Choose Next to step through the matches, or type in Replace with and choose Replace or Replace all.
  • Patterns use the .NET regular expression rules. Match case and Whole words still apply.
  • In Replace with, $1 puts back the first part of the match in brackets, $2 the second, and $0 the whole match.
  • A match stays inside one paragraph. A replacement cannot split a paragraph: \n and \t are kept as typed.
  • If the pattern has a mistake, the panel says "The pattern is not valid" with the reason. A pattern that would match empty text is refused: add something it must find.

Save a find

  1. Fill in the Find and replace panel the way you want it, including Replace with and the checkboxes.
  2. Choose Edit then Saved finds and patterns….
  3. Choose Save the current find….
  4. Type a name and choose OK.

A saved find keeps the find text, the replacement and the Pattern, Match case and Whole words settings. Saving under a name you already used replaces the old one. Saved finds belong to your Windows user, so they are offered in every book.

Run a saved find

  1. Choose Edit then Saved finds and patterns….
  2. Pick a find. The Find and replace panel opens with everything filled in.
  3. Choose Next, Replace or Replace all as usual.

To delete one, choose Remove a saved find… in the same list, then pick the find.

Built-in examples

The list also offers six patterns, marked "example":

ExampleFindsReplaces with
Double spacesTwo or more spaces in a row.One space.
Space before punctuationSpaces before a comma, period, semicolon, colon, exclamation mark or question mark.The punctuation without the space.
Repeated wordThe same word twice in a row.The word once.
Three dots to an ellipsisThree typed periods.One ellipsis character.
Two hyphens to an em dashTwo hyphens, with any spaces around them.An em dash with no spaces.
Words in capitalsWords of three or more capital letters.Nothing: use Next to review them, not Replace all.
Replace all is one step: press Ctrl+Z to undo every replacement at once.

Still stuck?

Choose Help then Report a problem… in LeafBound to send us the details, or write to support.

Contact supportError messages