Bracket Expressions
A bracket expression
- is denoted by
[ listOfCharacters]
- matches any single character from the list of characters
E.g. [aeiou] matches any vowel.
Shorthand is available for ranges of characters [ first-last]
E.g. [a-e] [a-z] [0-9] [a-zA-Z] [A-Za-z] [a-zA-Z0-9] [ -~]
(the last matches any printable character)
The matching can be inverted [^ listOfCharacters]
E.g. [^a-e] matches any character except one of the first five letters
Punctuation characters (except for ^\-[] ) lose their special meaning inside bracket expressions.
|