User guide

- 100 -
Appendix F
Extended Regular Expressions
Extended Regular Expressions is powerful system for filtering and matching string patterns.
Although you may be familiar with the wildcard characters used in DOS or Linux command
lines, such as the “?” and “*,” it is important to point out that these characters do not mean
the same thing in Extended Regular Expressions. The “?” and “*” are called quantifiers and
they by themselves do not represent actual characters. The wildcard character in Extended
Regular Expressions is the period (“.”). However, the “.” only represents a single instance of
any character (the way the “?” is normally understood in command lines). A quantifier, in
Extended Regular Expressions, tells you how many times an element to its left is allowed to
occur and still be considered a valid match. A “?” says that the element to its left is allowed
to occur zero or one time. For example, “colou?r” will match both “color” and “colour”
because the “u” can either not occur at all or occur only one time in the string to be valid. The
string “colouur” will not be a valid match in this example. The “*” means that the element to
its left can occur zero or more times. So, “colou*r” will match “color” or “colour” or
“colouur” or “colouuuur” and so on. Quantifiers require that it is preceded with an element
(or character). So, to get the same result as an “*” by itself in a command line, you must use
“.*” in Extended Regular Expressions. “.*” meaning match any character (“.” being the
wildcard character) occurring zero or more times in the string (as dictated by the “*”
quantifier).
Here are other example patterns:
An item which has the string “Compiler” in it.
Compiler
Items with various spellings of “Dijkstra” with the j replaced by any character
Di.kstra
Items with various spellings of “Dijkstra” with the “ijk” replaced by any number of
characters
D.*stra
An item with either “Compiler” or “compiler” in it.
[cC]ompiler
String like bananas, banananas, bananananas etc.
bana(na)+s
Items with the strings “regular” and “expression” on the same line with anything or nothing
between them
regular.*expression
Items with either regular or expression (or both).
regular|expression