This section shows you how the named regular expression classes may be used, for example, to match standard mathematical expressions, like *2 + 3 * (7 - 9)* or *2 + 3 * 8 - 11*.

First, we need to define a number of regular expression classes:

**group**
\((?$expr)\)
**factor**
\d+|(?$group)
**term**
(?$factor)( \* (?$factor)| / (?$factor))*
**expr**
(?$term)( \+ (?$term)| - (?$term))*

Now, if you execute the Find All command in regular expression mode and enter the

(?$expr)

as regular expression to search for, all mathematical expressions in the document get selected.