Regular Expressions

phreplace uses the vbscript regular expression engine, for more information on pattern matching, see the following Microsoft reference:
Microsoft Beefs Up VBScript with Regular Expressions

Note that the full stop (.) matches any character except \n. This means it also matches \r which can cause issues with Windows encoding which uses \r\n as the line break.

Backreferences

To use search matches in a replace term, surround the match you wish to use in parenthesis (brackets) and use $1, $2, $3 etc… in the replace term. e.g.

Text: The quick brown fox jumps over the lazy dog
Search: The quick brown (\w*) jumps over the lazy (\w*)
Replace: The $1 $2
Result: The fox dog

Use $& to match the entire search match.

Use $1, $2, etc. To match backreferences (parenthesis) in the search match.

Examples

Search: ^([^\n\r]+)$
Description: Matches a whole line.