Regex: Difference between revisions

156 bytes added ,  6 years ago
Line 36:
 
== Character Escapes ==
{| class="wikitable"
Escaped Char || Description
|-
ordinary characters || Characters other than . $ ^ { [ ( | ) ] } * + ? \ match themselves.
! Escaped Char ||!! Description
\a Matches a bell (alarm) \u0007.
|-
\b Matches a backspace \u0008 if in a []; otherwise matches a word boundary (between \w and \W characters).
ordinary| charactersOrdinary Characters || Characters other than .<nowiki> $ . ^ { [ ( | ) ] } * + ? \</nowiki> match themselves.
\t Matches a tab \u0009.
|-
\r Matches a carriage return \u000D.
| \v a || Matches a verticalbell tab(alarm) \u000Bu0007.
|-
\f Matches a form feed \u000C.
| \b || Matches a backspace \u0008 if in a [ ]; otherwise matches a word boundary (between \w and \W characters).
\n Matches a new line \u000A.
|-
\e Matches an escape \u001B.
| \t || Matches a tab \u0009.
\040 Matches an ASCII character as octal (up to three digits); numbers with no leading zero are backreferences if they have only one digit or if they correspond to a capturing group number. (For more information, see Backreferences.) For example, the character \040 represents a space.
|-
\x20 Matches an ASCII character using hexadecimal representation (exactly two digits).
| \r || Matches a carriage return \u000D.
\cC Matches an ASCII control character; for example \cC is control-C.
|-
\u0020 Matches a Unicode character using a hexadecimal representation (exactly four digits).
| \v || Matches a vertical tab \u000B.
\* When followed by a character that is not recognized as an escaped character, matches that character. For example, \* is the same as \x2A.
|-
 
| \f || Matches a form feed \u000C.
|-
| \n || Matches a new line \u000A.
|-
| \e || Matches an escape \u001B.
|-
| \040 || Matches an ASCII character as octal (up to three digits); numbers with no leading zero are backreferences if they have only one digit or if they correspond to a capturing group number. (For more information, see Backreferences.) For example, the character \040 represents a space.
|-
| \x20 || Matches an ASCII character using hexadecimal representation (exactly two digits).
|-
| \cC || Matches an ASCII control character; for example \cC is control-C.
|-
| \u0020 || Matches a Unicode character using a hexadecimal representation (exactly four digits).
|-
| \* || When followed by a character that is not recognized as an escaped character, matches that character. For example, \* is the same as \x2A.
|}
 
== Character Classes ==