Escape Sequences Regular Expressions Parent topic

Escape Sequences Regular Expressions

Element
What It Means
Example
\
In order to match some characters that have special meaning in regular expression (for example, "+").
(1) .REG. C\\C\+\+ matches ’r;C\C++’.
(2) .REG. \* matches *.
(3) .REG. \? matches ?.
\t
Indicates a tab character.
(stress) \t matches any block of text that contained the substring "stress" immediately followed by a tab (ASCII 0x09) character.
\n
Indicates a new line character.
Note
Note
Different platforms represent a new line character. On Windows, a new line is a pair of characters, a carriage return followed by a line feed. On Unix and Linux, a new line is just a line feed, and on Macintosh a new line is just a carriage return.
(stress) \n matches any block of text that contained the substring "stress" followed immediately by two new line (ASCII 0x0A) characters.
\r
Indicates a carriage return character.
(stress) \r matches any block of text that contained the substring "stress" followed immediately by one carriage return (ASCII 0x0D) character.
\b
Indicates a backspace character
(stress) \b matches any block of text that contained the substring ”r;stress” followed immediately by one backspace (ASCII 0x08) character.
\xhh
Indicates an ASCII character with given hexadecimal code (where hh represents any two-digit hex value).
\x7E(\w){6} matches any block of text containing a "word" of exactly six alphanumeric characters preceded with a ~ (tilde) character. So, the words ’r;~ab12cd’, ’r;~Pa3499’ would be matched, but ’r;~oops’ would not.