IBM Tivoli Composite Application Manager for Application Diagnostics, Version 7.1.0.1

Frequently used regular expressions

The following list highlights characters and operators most frequently used in regular expressions:

\

Quotes the character that follows it, which treats that character as a literal character or operator (not a regular expression). When you want the following characters to be treated as literal, precede them with a backslash:
*  ?  +  [  (  )  {  }  ^  $  |  \  .  /
In other words, use a backslash followed by a forward slash (\/) to include a forward slash in a URI filter. Use a backslash followed by a period (\.) to include a period in a URI filter.

Example: to specify the URI pattern http://www.ibm.com/, use the following regular expression:

http:\/\/www\.ibm\.com\/
To specify all URIs that begin with http://www.ibm.com/, use the following regular expression:
http:\/\/www\.ibm\.com\/.*

.

Matches any one character.

Example: to match both ibm2 and ibm3 within a string, use ibm. such as in the following example: http:\/\/www\.ibm.\.com\/

(?: … )

Non-capturing parentheses. Groups the included pattern, but does not provide capturing of matching text. Somewhat more efficient than capturing parentheses.

Example: you can use the non-capturing parenthesis to group expressions to form more complicated regular expressions. To match a URI that starts with one of the following URLs: http://www.ibm.com/marketing/ or http://www.ibm.com/sales/, you would do a grouping with a pipe sign (|) (represents or):

http://www.ibm.com/(?:marketing)|(?:sales)/

*

Matches the preceding element zero or more times. You must quote this character.

Example: the expression, ca*t, matches cat, caat, ct, and caaaaat. The term cabt, would not return as a match.


Parent topic:

Use regular expressions