Search and Replace

Search and Replace

What it does

This scripts performs a regular expression-based search and replace on each line in the source text.

Syntax for the Match

This field follows the Perl regular expression syntax.

If you are unfamiliar with Perl, you can enter any text into the Match field, but the characters \.,^$*+?{}[]()| are special, so you must escape them with \ if you want to use them.

Matches from parenthesized elements are extracted to $1, $2 etc as normal.

More information is available here.

Syntax for the Replace

This field is plain text, but also supports insertion of the $1, $2 etc variables.

Note: \n will be converted to a new line character. There is no way to escape this.

Options

  • Global replace in line will replace every instance of the match in each line. If left unticked, only the first match of each line will be replaced.
  • Treat as single line will treat the whole input as a single line.
  • Strip empty lines from results will strip any lines that are empty after performing the replace.
Source:
Optional: