Previous Topic: Specify Regular ExpressionsNext Topic: Set Password Restrictions


Regular Expressions Syntax

This section describes the syntax you use to construct regular expressions for password matching. This syntax is consistent with the regular expression syntax supported for resource matching when specifying realms.

Characters

Results

\

Used to quote a meta-character (like ’*’)

\\

Matches a single ’\’ character

(A)

Groups subexpressions (affects order of pattern evaluation)

[abc]

Simple character class (any character within brackets matches the target character)

[a-zA-Z]

Character class with ranges (any character range within the brackets matches the target character)

[^abc]

Negated character class

.

Matches any character other than newline

^

Matches only at the beginning of a line

$

Matches only at the end of a line

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*?

Matches A 0 or more times (reluctant)

A+?

Matches A 1 or more times (reluctant)

A??

Matches A 0 or 1 times (reluctant)

AB

Matches A followed by B

A|B

Matches either A or B

\1

Backreference to 1st parenthesized subexpression

\n

Backreference to nth parenthesized subexpression

All closure operators (+, *, ?) are greedy by default, meaning that they match as many elements of the string as possible without causing the overall match to fail. If you want a closure to be reluctant (non-greedy), you can simply follow it with a ’?’. A reluctant closure will match as few elements of the string as possible when finding matches.