VBS tutorial: introduction to regular expressions – establishing regular expressions


Establish regular expression

The method of constructing regular expressions is the same as that of creating mathematical expressions. That is to combine small expressions with a variety of metacharacters and operators to create larger expressions.

You can construct a regular expression by placing various components of the expression pattern between a pair of separators. For Visual Basic Scripting Edition, the separator is a pair of forward slash (/) characters. For example:


For VBScript, a pair of quotation marks (“”) are used to determine the boundary of the regular expression. For example:


In the two examples shown above, the regular expression pattern(expression)All stored inRegExpObjectPatternProperty.

The components of a regular expression can be a single character, a character set, a character range, a selection between characters, or any combination of all these components.