Regular expressions

Regular expressions provide a way to search for a general pattern of text rather than a specific piece of text. For example, you use a regular expression to search for license plates. The search might be based on a partial sighting, that is you know some but not all of the required characters.

A regular expression is written as a sequence of characters. The syntax combines the text for which you are searching with special characters to define the pattern. Unlike a simple search, a regular expression search is case-sensitive.

Chart Reader does not support extended regular expression combinations (), \(\), \>, \<, \{, \} and \digit.

Examples

^Room [0-9]* Mill Court

Matches addresses of any room number in Mill Court, for example Room 4 Mill Court, Room 61 Mill Court but not Room 4a Mill Court.

^[0-9][ a-zA-Z]*[^0-9]$

Matches text that starts with a digit ^[0-9], followed by zero or more upper or lowercase characters [ a-zA-Z]* and which do not end with a digit [^0-9]$, for example 1aB, 1Ab, 2a.

The special characters you can use in a regular expression are described in the following table:

. Matches a single character. For example, fre. matches fred and free. This is equivalent to the ? character when searching for files by name in Windows Explorer.
^ Matches the start of a line. For example, ^free matches free and free-port but not post-free.
$ Matches the end of a line. For example, free$ matches free and post-free but not free-port.
* Matches zero, one or more repeats of the previous character. For example xx* matches xx, xxx, xxxx .
[] Matches any character inside the brackets. You can specify a range of characters, for example [0-9], [ a-z].
[^] Matches any characters except the characters in the list.
| Matches either the expression before the bar OR the expression after the bar. For example,abc$|def$ matches any text that ends abc or def.
\ Ignores the special meaning of the next character. For example, abc$|def$|\|$ matches any text that ends in abc, def or |