The full syntax accepted by regular expressions is described below.
UNIX regular expressions comprise a powerful pattern matching language. In Applications Manager, regular expressions are allowed in Search fields on the administration selection windows and when defining file associations.
By default, searches assume that:
Example regular expressions are shown in the table below. They are followed by the full syntax accepted by regular expressions.
Example Regular Expressions
Some quick examples of regular expression searches are listed below:
To search for: | Use the following: |
---|---|
A single character wild card |
. |
A multiple character wild card |
.* |
All objects which start with M |
M (same as ^M.* or M.*) |
All objects which end with M |
.*M$ |
All objects which contain -TUE- |
.*-TUE- (same as .*-TUE-.*) |
All objects in which second letter is A |
.A (same as .A.*) |
All objects which have the second to last letter A |
.*A.$ |
All objects which start with 'SET' or with 'PROD' |
set|^prod (same as typing ^set.*|^prod.*) |
Characters
Character | Description |
---|---|
unicodeChar |
Matches any identical Unicode character |
\ |
Used to quote a meta-character (like '*') |
\\ |
Matches a single '\' character |
\0nnn |
Matches a given octal character |
\xhh |
Matches a given 8-bit hexadecimal character |
\\uhhhh |
Matches a given 16-bit hexadecimal character |
\t |
Matches an ASCII tab character |
\n |
Matches an ASCII newline character |
\r |
Matches an ASCII return character |
\f |
Matches an ASCII form feed character |
Character Classes
Class | Description |
---|---|
[abc] |
Simple character class |
[a-zA-Z] |
Character class with ranges |
[^abc] |
Negated character class |
Standard POSIX Character Classes
Class | Description |
---|---|
[:alnum:] |
Alphanumeric characters |
[:alpha:] |
Alphabetic characters |
[:blank:] |
Space and tab characters |
[:cntrl:] |
Control characters |
[:digit:] |
Numeric characters |
[:graph:] |
Characters that are printable and are also visible. (A space is printable, but not visible, while an 'a' is both) |
[:lower:] |
Lower-case alphabetic characters |
[:print:] |
Printable characters (characters that are not control characters) |
[:punct:] |
Punctuation characters (characters that are not letter, digits, control characters, or space characters) |
[:space:] |
Space characters (such as space and formfeed to name a few) |
[:upper:] |
Upper-case alphabetic characters |
[:xdigit:] |
Characters that are hexadecimal digits |
Non-Standard POSIX-Style Character Classes
Class | Description |
---|---|
[:javastart:] |
Start of a Java identifier |
[:javapart:] |
Part of a Java identifier |
Predefined Classes
Class | Description |
---|---|
. |
Matches any character other than newline |
\w |
Matches a 'word' character (alphanumeric plus '_') |
\W |
Matches a non-word character |
\s |
Matches a white space character |
\S |
Matches a non-white space character |
\d |
Matches a digit character |
\D |
Matches a non-digit character |
Boundary Matchers
Match | Description |
---|---|
^ |
Matches only at the beginning of a line |
$ |
Matches only at the end of a line |
\b |
Matches only at a word boundary |
\B |
Matches only at a non-word boundary |
Greedy Closures
Closure | Description |
---|---|
A* |
Matches A 0 or more times (greedy) |
A+ |
Matches A 1 or more times (greedy) |
A? |
Matches A 1 or 0 times (greedy) |
A{n} |
Matches A exactly n times (greedy) |
A{n,} |
Matches A at least n times (greedy) |
A{n,m} |
Matches A at least n but not more than m times (greedy) |
Reluctant Closures
Closure | Description |
---|---|
A*? |
Matches A 0 or more times (reluctant) |
A+? |
Matches A 1 or more times (reluctant) |
A?? |
Matches A 0 or 1 times (reluctant) |
Logical Operators
Operator | Description |
---|---|
AB |
Matches A followed by B |
A|B |
Matches either A or B |
(A) |
Used for sub-expression grouping |
Backreferences
Backreference | Description |
---|---|
\1 |
Backreference to 1st parenthesized sub-expression |
\2 |
Backreference to 2nd parenthesized sub-expression |
\3 |
Backreference to 3rd parenthesized sub-expression |
\4 |
Backreference to 4th parenthesized sub-expression |
\5 |
Backreference to 5th parenthesized sub-expression |
\6 |
Backreference to 6th parenthesized sub-expression |
\7 |
Backreference to 7th parenthesized sub-expression |
\8 |
Backreference to 8th parenthesized sub-expression |
\9 |
Backreference to 9th parenthesized sub-expression |