Regular expressions

From TED Notepad
Revision as of 12:22, 1 August 2011 by Jsimlo (talk | contribs) (Created page with "<!-- →‎*****************************************************************: →‎Full list of supported/reserved constructs in pattern. Any of: /* these constructs may appear ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Replace patterns

Any of these constructs may appear anywhere in the replace pattern, as long as regular expressions are turned on.

\\
Inserts a backslash.
\n
Inserts a newline sequence (CR, NL or CR/NL; depends on current document options).
\t
Inserts a horizontal tab character (TAB).
\f
Inserts a form feed character (FF).
\a
Inserts a vell character (BEL).
\v
Inserts a vertical tab (VT).
\e
Inserts an escape character (ESC).
\0
Inserts a null character (NUL).
\xhh
Inserts a character in hex notation.
\uhhhh
Inserts a character in unicode notation (unicode version only).
\cA
Inserts a character in control notation.
\Q ... \E
Quoted string. Anything between \Q and \E is treated as plain-text string.
\&
Back-reference to the entire match.
\1, \2, ..., \9
Back-reference to a specific captured group.
\+
Back-reference to the last successfull captured group. Consider having several alternations, each with a group inside it. Only one of the alternations will match, thus only one of those groups will be valid upon replacing. This back-reference allows referencing the correct one of those groups, based on which of the alternations matched.
  • Note: This can also be achieved by using branch restart groups.