April 2014
Intermediate to advanced
960 pages
22h 9m
English
This appendix summarizes methods of creating and using regular expressions.
This section describes the characters you can use to define regular expressions.
Character escapes are character sequences that match special characters. The following table summarizes useful character escapes.
| Escape | Meaning |
\t | Matches the tab character |
\r | Matches the return character |
\n | Matches the new-line character |
\nnn | Matches a character with ASCII code given by the two or three octal digits nnn |
\xnn | Matches a character with ASCII code given by the two hexadecimal digits nn |
\unnnn | Matches a character with Unicode representation given by the four hexadecimal digits nnnn |
A character class matches one of a set of characters. The following table summarizes useful character class constructs.
| Construct | Meaning |
[chars] | Matches one of the characters inside the brackets. For example, [aeiou] matches a single lowercase vowel. |
[^chars] | Matches a character that is not inside the brackets. For example, [^aeiouAEIOU] matches a single nonvowel character such as Q, ?, or 3. |
[first-last] | Matches a character between the character first and the character last. For example, [a–z] matches any lowercase letter between a and z. You can combine multiple ranges as in [a-zA-Z], which matches uppercase or lowercase letters. |
. | This is a wildcard that matches any single character except \n. (To match a period, use the |
Read now
Unlock full access