Regular Expression syntax to exclude values from a wildcard expression
RegEx (Regular Expressions) is commonly used when configuring UAG portal applications. In addition, RegEx is also used when configuring application customizations such as AppWrap and SRA.
I recently worked with a customer that posed a fairly unique question. He wanted to know how to create a regular expression that would match the following:
Include any server in domain.com, excluding server02.domain.com
The Regular Expression that will accomplish this is as follows:
^(?:(?!server02).)*\.domain\.com
Explanation:
(?!server02) = Impossible to match ‘server02’
(?: (?!server02) .) = ‘?:’ indicates not to create a backreference. ‘Dot’ indicates to match any single character.
^ (?:(?!server02).) * = ‘Carat’ indicates to assert the position at the beginning of the string. ‘Asterisk’ indicates to match between zero and unlimited number of times.
\.domain\.com = “.domain.com”
Blog post written by Richard Barker