Search Option: Regular Expression (Regex)

EditPad's search-and-replace module includes a full-featured regular expression engine. Its regular expression flavor is compatible with popular regular expression flavors such as those used by Perl, Java, and .NET. In the regular expression flavor comparison, EditPad's flavor is indicated as "JGsoft". To search using a regular expression, simply turn on the regular expression search option by clicking the Regex button on the search toolbar.

When using capturing groups in a regular expression, you can insert the groups' contents in the replacement text using backreferences \0, \1, \2, etc. \0 inserts the whole regex match, while \1 inserts the text matched by the first capturing group, \2 the second group, etc. EditPad Pro supports up to 99 backreferences. If you want to insert a backreference followed by a literal number into the replacement text, use two digits for the backreference. The replacement text \15 will replace the regex match with the contents of the first backreference followed by the digit 5. You can also use dollar signs instead of backslashes. There's no difference between \1 and $1 in the replacement text in EditPad.

If you want to pad or control the case of backreferences, use the %GROUP1% syntax for match placeholders.

If you use \r and \n in your regex, remember that Windows text files use \r\n terminate lines. EditPad's regular expression engine matches \r and \n to a single CR and a single LF. If you want differences in line breaks to be handled automatically, use the full search panel and press Shift+Enter to type in an actual line break into your regular expression. EditPad's regular expression engine will match each literal line break in your regular expression to either a CRLF pair, or a single LF, or a single CR.

The caret and dollar always match at the start and the end of a line, in addition to the start and the end of a file. EditPad Pro does not have an option to change this. To match the start or the end of the file only, use \A or \z instead. The behavior of the dot can be changed with the "dot matches newline" option.

EditPad Pro does not have a search option to use free-spacing regular expressions. It does support the mode modifier (?x). If you put (?x) at the very start of your regular expression, then any whitespace after the (?x) is ignored, unless it is escaped or inside a character class.

See also

Search|Prepare to Search
Search Options
Search Option: Dot Matches Newline