[Image of Linux]
The Personal Web Pages of Chris X. Edwards

Regular Expression Tutorial

--------------------------

Negated Character Classes

(a.k.a. Complement, Not)

Matching particular characters is a very common operation, but perhaps even more common is matching for anything but particular specified characters. The syntax to find any character except certain ones is:

re-notABC

This matches any character that is neither an "A", nor a "B", nor a "C". To search for any character that is a consonant, it might be easiest to specify all characters that are not vowels.

re-NOTaeiouAEIOU

is similar to [bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]. The reason it is not exactly the same is that [^aeiouAEIOU] includes more than just consonants. It included symbols and numbers and every conceivable character that isn't a vowel.

--------------------------
Previous Home Next
This page was created with only free, open-source, publicly licensed software.
This page was designed to be viewed with any browser on any system.
Chris X. Edwards ~ December 2003