Build a Regular Expression
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Build a Regular Expression

The construction of regular expressions is analogous to the construction of arithmetic expressions. That is, a variety of metacharacters and operators combine small expressions to create large expressions.

You construct a regular expression by putting the various components of the expression pattern between a pair of delimiters. For JScript, the delimiters are forward slash (/) characters. For example:


In the above example, the regular expression pattern (expression) is stored in the Pattern property of the RegExp object.

The components of a regular expression can be individual characters, sets of characters, ranges of characters, choices between characters, or any combination of all of these components.

© 2015 Microsoft