Because regular expressions that may be used in TrEd are the same as regular expressions that are defined in Perl, the following text is an extraction from Perl documentation.
The following metacharacters have their standard *egrep*-ish meanings:
The following standard quantifiers are recognized:
(If a curly bracket occurs in any other context, it is treated as a regular character.) The "*" modifier is equivalent to `{0,}', the "+" modifier to `{1,}', and the "?" modifier to `{0,1}'. n and m are limited to integral values less than 65536.
By default, a quantified subpattern is "greedy", that is, it will match as many times as possible (given a particular starting location) while still allowing the rest of the pattern to match. If you want it to match the minimum number of times possible, follow the quantifier with a "?". Note that the meanings don't change, just the "greediness":
Because patterns are processed as double quoted strings, the following also work:
If UseCzechLocales is set to non-zero value in TrEd's configuration, the list of alphabetic characters generated by `\l',`\u',`\L',`\U' is taken from the Czech locale. In addition, the following characters are defined:
Note that `\w' matches a single alphanumeric character, not a whole word. To match a word you'd need to say `\w+'. If UseCzechLocales is set to non-zero value in TrEd's configuration, the list of alphabetic characters generated by `\w' is taken from the Czech locale. You may use `\w', `\W', `\s', `\S', `\d', and `\D' within character classes (though not as either end of a range).
The following zero-width assertions are defined:
A word boundary (`\b') is defined as a spot between two characters that has a `\w' on one side of it and a `\W' on the other side of it (in either order), counting the imaginary characters off the beginning and end of the string as matching a `\W'. (Within character classes `\b' represents backspace rather than a word boundary.) The `\A' and `\Z' are just like "^" and "$".
When the bracketing construct `( ... )' is used, \<digit> matches the digit'th substring. If you want to use parentheses to delimit a subpattern (e.g., a set of alternatives) without saving it as a subpattern, follow the ( with a ?:.
You may have as many parentheses as you wish. Within the pattern, \10, \11, etc. refer back to substrings if there have been at least that many left parentheses before the backreference. Otherwise (for backward compatibility) \10 is the same as \010, a backspace, and \11 the same as \011, a tab. And so on. (\1 through \9 are always backreferences.)
$+ returns whatever the last bracket match matched. $& returns the entire matched string. ($0 used to return the same thing, but not any more.) `$`' returns everything before the matched string. `$'' returns everything after the matched string.
TrEd defines a consistent extension syntax for regular expressions. The syntax is a pair of parentheses with a question mark as the first thing within the parentheses (this was a syntax error in older versions of Perl). The character after the question mark gives the function of the extension. Several extensions are already supported: