Documentation
|
Support
Standard Regular Expression Strings
Standard Regular Expression Strings
Regular expressions (regex) are a powerful way of matching a sequence of simple characters. You can use regular expressions in the Directory Synchronization Client to create filters (see
Filters
).
Regular expressions are case-sensitive: a lowercase "a" is distinct from an uppercase "A." You can enclose a range of characters in square brackets to match against all of those characters. For example:
Expression
Description
[tT]here
matches against "There" and "there"
[ ]
may also be used on a range of characters separated by a – character.
[0-9]
matches any digit.
[A-Z]
matches any uppercase alpha character
[A-Za-z0-9]
matches any alphanumeric character
^
is the "not" character, so [^0-9] matches against any character that is not a digit.
Although you can use ranges to specify a group of characters, you can also use the following shortcuts:
Expression
Description
.
matches against any character
\d
matches against a digit [0-9]
\D
matches against a non-digit [^0-9]
\s
matches against a whitespace character (such as a tab, space, or line feed character)
\S
matches against a non-whitespace character
\w
matches against an alphanumeric character [a-zA-Z_0-9]
\W
matches against a non-alphanumeric character
\x
hh
matches against a control character (for the hexadecimal character
hh
)
\u
hhhh
matches against a Unicode character (for the hexadecimal character
hhhh
)
Note
As the backslash character is used to denote a specific search expression, if you want to match against this character, you must enter a double backslash (
\\
).
To match against occurrences of a character or expression, you can use the following.
Expression
Description
*
matches against zero or more occurrences of the previous character or expression
+
matches against one or more occurrences of the previous character or expression
?
matches zero or one occurrences of the previous character or expression
(n)
matches n occurrences of the previous character or expression
(n,m)
matches from n to m occurrences of the previous character or expression
(n,)
matches at least n occurrences of the previous character or expression
You can provide text to replace all or part of your search string. To do this, you need to group together matches by enclosing them in parentheses so they can be referenced in the replacement. To reference a matched parameter, use
$n
where
n
is the parameter starting from 1.
For regular expression examples, see
Regular expression examples
.
Standard Regular Expression Strings
Copyright 2022 Forcepoint LLC. All rights reserved.