Regular Expressions/POSIX-Extended Regular Expressions

The more advanced "extended" regular expressions can sometimes be used with Unix utilities by including the command line flag "-E". Other Unix utilities, like awk, use it by default.

The main difference is that some backslashes are removed:  becomes {&hellip;} and   becomes (&hellip;). Examples:
 * " " matches with "hat", "cat", "hhat", "chat", "hcat", "ccchat" etc.
 * " " matches "<tt>hat</tt>", "<tt>cat</tt>" and "<tt>at</tt>"
 * " " matches "<tt>cat</tt>", "<tt>Cat</tt>", "<tt>dog</tt>" and "<tt>Dog</tt>"

The characters <tt>,[,],.,*,?,+,|,^</tt> and <tt>$</tt> are special symbols and have to be escaped with a backslash symbol in order to be treated as literal characters. For example:
 * " " matches with the string "<tt>a.)</tt>" or "<tt>a.(</tt>"

Modern regular expression tools allow a quantifier to be specified as non-greedy, by putting a question mark after the quantifier:.

Table of metacharacters
The following metacharacters are used:

Character classes
The POSIX standard defines some classes or categories of characters as shown in the following table:

Links:
 * Regular_expression
 * Character Classes that are Always Supported at boost.org

Use in Tools
Tools and languages that utilize this regular expression syntax include:


 * AWK - uses a superset of the extended regular expression syntax

Links

 * POSIX Basic Regular Expressions at regular-expressions.info
 * POSIX Extended Regular Expression Syntax at boost.org