32.9. Regular Expressions: Exceptions in a Character Set
You can easily search for all characters except those in square brackets by putting a caret (^) as the first character after the left square bracket ([). To match all characters except lowercase vowels, use [^aeiou].
Like the anchors in places that can't be considered an anchor, the right square bracket (]) and dash (-) do not have a special meaning if they directly follow a [. Table 32-2 has some examples.
Table 32-2. Regular expression character set examples
Many languages have adopted the Perl regular expression syntax for ranges; for example, \w is equivalent to "any word character" or [A-Za-z0-9_], while \W matches anything but a word character. See the perlre(1) manual page for more details.
Copyright © 2003 O'Reilly & Associates. All rights reserved.