Regular expressions are a mini-language designed and optimized to manipulate text. They are composed of two basic character types: literal, or normal, text characters, and metacharacters. The set of metacharacters give regular expressions their processing power.
You are probably familiar with the metacharacters ? and * used with the DOS file system to represent any single character or any group of characters. The DOS file command COPY *.DOC A: commands the file system to copy files of any name but with a .DOC filename extension to the disk in drive A. The metacharacter "*" matches any file name in front of the file name extension ".DOC". Regular expressions extend this basic idea many times over, and provide a large set of metacharacters that make it possible to describe very complex text-matching expressions with relatively few characters.
For example, the regular expression "\\s2000" when applied to a body of text will match all occurrences of the string "2000" that is preceded by a space in that text.
NOTE: In the above expression, the special escaped character \s is preceded by a backslash to signal that the backslash in the escaped character should be treated as a literal character. Otherwise, the backslash and the s will be treated as two separate operators. All special escaped characters must appear this way in regular expression strings.
For a more complex example, the regular expression (?<char>\\w)\\k<char>, using named groups and backreferencing (explained in the following sections), looks for adjacent paired characters. When applied to the following string, it will find matches in the words "I'll", "tall" and "latte".
I'll have a double tall latte.
The following sections detail the set of metacharacters that define the NGWS frameworks regular expression language and show how to use the regular expression classes to implement regular expressions in your applications.