NETCOOL regular expression library

If your system supports single-byte character languages, you can use the NETCOOL regular expression library to run search queries on your data. The NETCOOL library provides better system performance than the TRE regular expression library.

Note: When a regular expression is written in SQL, the SQL parser first processes string literals before passing them to the regular expression library. The SQL parser processes backslash sequences, so single backslashes will not subsequently be seen by the regular expression library. Therefore, when you write a regular expression in SQL, use double backslashes to escape reserved characters.

For example, to escape the parentheses in the string '1_(22)', use this expression: '1_\\(22\\)'.

The NETCOOL regular expression library supports the use of normal characters and metacharacters. The following table describes the set of metacharacters supported by the NETCOOL regular expression library.

Table 1. Metacharacters
Metacharacter Description Examples
* Matches zero or more instances of the preceding atom. Matches as many instances as possible. goo* matches my godness, my goodness, and my gooodness, but not my gdness.
+ Matches one or more instances of the preceding atom. Matches as many instances as possible. goo+ matches my goodness and my gooodness, but not my godness.
? Matches 1 or zero instances of the preceding atom. colou?r matches color and colour.

end-?user matches enduser and end-user.

$ Matches the end of the string. end$ matches the end, but not the ending.
^ Matches the beginning of the string. ^severity matches severity level 5, but not The severity is 5.
. Matches any single character. b.at matches baat, bBat, and b4at, but not bat or bB4at.
[abcd] Matches any character in the square brackets. [nN][oO] matches no, nO, No, and NO.

gr[ae]y matches both spellings of the word ’grey’; that is, gray and grey.

[a-d] Matches any character in the range of characters separated by a hyphen (-). [0-9] matches any decimal digit.

[ab3-5] matches a, b, 3, 4, and 5.

^[A-Za-z]+$ matches any string that contains only upper or lowercase characters.

[^abcd]

[^a-d]

Matches any character except those in the square brackets or in the range of characters separated by a hyphen (-). [^0-9] matches any string that does not contain any numeric characters.
() Indicates that the characters within the parentheses should be treated as a character pattern. A(boo)+Z matches AbooZ, AboobooZ, and AbooboobooZ, but not AboZ or AboooZ.

Jan(uary)? matches Jan and January.

| Matches one of the atoms on either side of the pipe character. A(B|C)D matches ABD and ACD, but not AD, ABCD, ABBD, or ACCD.

(AB | CD) matches AB and CD, but not ABD and ACD.

\ Indicates that the metacharacter following should be treated as a regular character. The metacharacters listed in this table require a backslash escape character as a prefix to switch off their special meaning. \* matches the * character.

\\ matches the \ character.

\. matches the . character.

\[[0-9 ]*\] matches an opening square bracket, followed by any digits or spaces, followed by a closed bracket.