isRegEx update

The following table replaces the table in Chapter 3, “Building Production Objects,” in the Examples section that describes using special characters for the isRegEx built-in qualification function:

Table 1: isRegEx special characters

Symbol

Description

[ ]

Brackets define a range of characters to match to a single character position. The example looks for any string that begins with the characters “abc” then has a “d”, “e”, or “f”, followed by a “g”.

Example – “gr[ae]y” matches “gray” and “grey”, but does not match “graay” or “graey”.

.

A period matches single character (except newline).

Example – “abc.g” matches “abcag”, “abcbg”, “abccg”, and so on.

*

An asterisk matches the preceding character 0 or more times.

Example – “a*” matches “aa”, “a”, “aaa” and so on.

^

A caret sign as the first character of a regular expression anchors the expression to the beginning of a line. Strings that start with the expression’s characters that follow the ^ fulfill the search criteria.

Example – “^ab” matches “abrefok” but not “erafxab”.

+

A plus sign following a regular expression repeats the expression one or more times.

Example – “[1-5]+” is equivalent to “[1-5][1-5]*”.

Specifies a range of characters.

  • If the minus sign is in an expression in brackets, it matches on a string of consecutive values.

    Example – “[a-e]” is equivalent to “[abcde]”.

  • If the minus sign is placed immediately after an opening bracket ([), it matches on a hyphen.

    Example – “[-[]” matches the characters “-” and “[“.

$

A dollar sign as the last character of a regular expression anchors the expression to the end of a line. Strings that end in the expression’s characters that precede the $ fulfill the search criteria.

Example – “ab$” matches “erafxab” but not “abrefok”.

?

Makes the preceding character optional.

Example – “abc?” matches “ab” or “abc”.

{m} {m,} {m,u}

Integers that specify the number of times to repeat the preceding regular expression. “m” is the minimum number and “u” is a number in the range of 0 – 255. The expression “{m}” by itself indicates the exact number of times the preceding regular expression should be repeated.

Example – “a{3}” matches “aaa”.

The expression “{m,}” specifies “{m,infinity}”.

( )

Round brackets group parts of a regular expression together. Round brackets can also create a “back reference”, which stores the part of the string matched by the part of the regular expression inside the parentheses.

NoteOnly round brackets can be used for grouping. Square brackets define a character class, and curly braces are used by a special repetition operator.

Use parentheses to group other expressions. Operators like *, {}, and + can work on a regular expression enclosed in parentheses ( ) as well as on a single character.

You can also make several characters optional by grouping them together using round brackets, and placing the question mark after the closing bracket. For example, “Nov(ember)?” matches both “Nov” and “November”.

\

You can use any of the above characters as a literal value by preceding the character with a backslash. The backslash works on only one character at a time.

Example – “AB\.\*CD” matches to the literal “AB.*CD”.

NoteAll other regular characters should not be preceded with a backslash because the backslash is also a special character. The backslash in combination with a literal character can create special meaning; for example, “\d” matches a single digit from 0 to 9.