A regular expression is a way of defining a pattern in a text string. In a text string naming policy value, you can use a regular expression to control how users enter a text string. For example, you can require the string to be in all uppercase or lowercase letters, to only included letters and not numbers, or to be only of a certain length.
Shown here are regular expression operators you can use the Regular Expression field on the Add Naming Policy Value and Add Naming Policy Value pages.
To match | Operator | Matches |
---|---|---|
A specific case-sensitive string | string | Matches only string, where string is a value typed into the
Regular Expression field. The string must not contain
spaces. For example: Address matches Address but not address |
One case sensitive string or another case sensitive string | string1|string2 | Matches either string1 OR string2. string1 and
string2 must not contain spaces. For example: Address|Example matches Address or Example but not address or example |
A single character from a range of characters | [x-y] | Matches a range of characters or numbers, where x and y specify
the first and last characters in the range. For example:
|
A specific number of characters | {n} | Matches the specified number of characters, where n is a number. For example: [a-z]{4} matches abcd but not abc or ABCD |
A variable number of characters | {min,max} | Matches the specified number of characters, where min is the minimum
number of characters and max is the maximum number of characters. For example: [a-z]{4,6} matches abcd and abcdef, but not abc or abcdefg. |
One or zero characters | ? | Matches one or zero occurrences of a character. For example: [0-9]? matches none or one number from 0 to 9. |
Anything other than the specified characters | [^string] | Excludes any of the characters in string; string can't contain
spaces. For example:
|
Any single character | . | Type a “.” period in the Regular Expression field.
Matches any single character. For example:
|
To include a character that's normally part of a regular expression operator, precede the character with \ (backslash).