Go to the table of contents Go to the previous page Go to the next page View or print as PDF
Standard Regular Expression Strings > Regular expression examples
Regular expression examples
Example 1: Filtering all addresses without a domain
 
The string @.* matches against anything following an @ symbol, which indicates that a domain is present. The ^ symbol ensures that matching strings are excluded from replacement, and all data without a domain is removed.
Example 2: Appending "acme.com" to every email address
 
The string \s* removes any whitespace at the start of the matching string, and (\S*) matches against the remaining non-whitespace characters. The parentheses allow you to reference this matching string as parameter 1 ($1).
In the replacement string, $1 contains the text matched by \S*, and then acme.com is appended to that text.
Example 3: Removing a selection of characters from an email address
 
The string [#!_\.\s]* matches against the pound (#), exclamation mark, underscore, period, and whitespace characters, with the final asterisk allowing multiple matches. The string (.*) on either side places all other characters in parameters 1 and 2. These parameters then form the replacement string, stripping out all instances of the matched characters.
Example 4: Converting .org domains to .com
 
The match string .*@acme\. detects any address that contains the string @acme. and is preceded by 1 or more characters. The final full stop needs to be escaped (preceded by a backslash), to avoid being interpreted as any character.
The parentheses around this part of the match string ensure the string is placed in parameter 1. The final org in the match is outside the parentheses, hence it does not get placed in parameter 1. The replacement string contains the text com which is appended to the string matched by:
.*@acme\.
Example 5: Filtering out all addresses from 2 domains
 
These filters match and exclude any email address that ends in @somewhere.com or @here.com. The remaining email addresses are uploaded.
Changing wildcard filters to regular expressions
All filters in the Directory Synchronization Client must be of the same type, either regular expression or wildcard. To change from wildcard filters to regular expressions, convert your filters as follows:
*
*

Go to the table of contents Go to the previous page Go to the next page View or print as PDF
Standard Regular Expression Strings > Regular expression examples
Copyright 2022 Forcepoint LLC. All rights reserved.