Specifications

If we wish to apply a quantifier to more than just the preceding character we can use parentheses
to group characters together in an expression. For example, tag+ matches a 't' followed by an
'a' followed by at least one 'g', whereas (tag)+ matches at least one occurrence of 'tag'.
Note that quantifiers are "greedy". They will match as much text as they can. For example, 0+
will match as many zeros as it can from the first zero it finds, e.g. '2.0005'.
Capturing text
Parentheses allow us to group elements together so that we can quantify and capture them. For
example if we have the expression mail|letter|correspondence that matches a string we know
that one of the words matched but not which one. Using parentheses allows us to "capture"
whatever is matched within their bounds, so if we used (mail|letter|correspondence) and matched
this regexp against the string "I sent you some email" we would capture 'mail'.
We can use captured text within the regexp itself. To refer to the captured text we use
backreferences which are indexed from 1. For example we could search for duplicate words in a
string using \b(\w+)\W+\1\b which means match a word boundary followed by one or more word
characters followed by one or more non-word characters followed by the same text as the first
parenthesized expression followed by a word boundary.
If we want to use parentheses purely for grouping and not for capturing we can use the
non-capturing syntax, e.g. (?:green|blue). Non-capturing parentheses begin '(?:' and end ')'.
In this example we match either 'green' or 'blue' but we do not capture the match so we only
know whether or not we matched but not which color we actually found. Using non-capturing
parentheses is more efficient than using capturing parentheses since the regexp engine has to
do less book-keeping.
Both capturing and non-capturing parentheses may be nested.
Anchors
Anchors match the beginning or end of the string but they do not match any characters.
Regular expressions entered in the Switch user interface always match the complete string. In
other words the regexp is automatically anchored at the beginning and at the end of the string,
and you shouldn't specify explicit anchors. (Regular expressions specified in a Switch JavaScript
program should include explicit anchors as needed).
MeaningAnchor
The caret signifies the beginning of the string. If you wish to match
a literal ^ you must escape it by writing \^. For example, ^#include
^
will only match strings which begin with the characters '#include'.
(When the caret is the first character of a character set it has a
special meaning, see Sets of Characters.)
The dollar signifies the end of the string. For example \d\s*$ will
match strings which end with a digit optionally followed by
$
whitespace. If you wish to match a literal $ you must escape it by
writing \$.
Assertions
Assertions make some statement about the text at the point where they occur in the regexp but
they do not match any characters. In the following list E stands for any expression.
200
Enfocus Switch 10