Use of regular expressions

You can use regular expressions in OQL and in stitcher language code. Regular expressions are particularly useful for defining filters.

Regular expressions contain a series of characters that define a pattern of text to be matched—to make a filter more specialized, or general. For example, the regular expression ^AL[.]* searches for all items beginning with AL. The filter condition EntityName Like ^..N[.]* filters for all devices which have an N as the third letter of their name, and EntityName Like [.]*G filters for all devices whose name ends with the letter G. The following table describes the most common characters used in regular expressions.
Table 1. Regular expression characters
Character Description Example

\

The backslash (or escape character) quotes the character after it, both special and ordinary.

Use the backslash to specify a . (normally a special character) in a file name, for example. To select all .sys files you would state, ^*\.sys$, where the backslash specifies that the dot following it is actually a real dot, not just a character representing any single character.

.

The dot represents any single character.

A dot can be anything. If you want to select five letter device names that begin with T and end with R, you would state, ^T...R$, where the three dots in the middle mean that the three middle letters of the word can be any letter.

*

Like the dot, an asterisk can represent any character. However, whereas the dot can only represent a single character, the asterisk represents anywhere from zero to an infinite amount of characters.

*.*, returns strings beginning with any combination and any amount of characters (the first asterisk), and can end with any combination and any amount of characters (the last asterisk). This selects every single string available.

$

The dollar sign at the end of a regular expression signifies the end of a line, and, therefore, any character immediately before it must be located at the end of the string. Anywhere else in a regular expression, it matches itself.

[.]*G$ selects every string which ends in G, regardless of the number of characters or types of characters in the string.

^

A hat (circumflex) at the beginning of a regular expression means that it is the beginning of a line, and any characters immediately following it must be located at the very beginning of the string. Anywhere else in a regular expression, it matches itself.

^AL[.]* returns strings beginning with AL. ^..N[.]* returns strings beginning (^) with any two characters and the third character is an N.

[set]

A set of characters in square parentheses matches any single character from a set.

^[abc].[def]$ selects all three character strings that begin with either a or b or c and end in either d or e or f.