SoFunction
Updated on 2025-04-08

VBS Tutorial: Introduction to Regular Expressions - Create Regular Expressions

Create regular expressions

The method of constructing regular expressions is the same as the method of creating mathematical expressions. That is, use multiple metacharacters and operators to combine small expressions to create larger expressions.

A regular expression can be constructed by putting various components of the expression pattern between a pair of separators. For Visual Basic Scripting Edition, the delimiter is a pair of forward slashes (/) characters. For example:

/expression/

For VBScript, a pair of quotes ("") is used to determine the boundaries of the regular expression. For example:

"expression"

In the two examples shown above, the regular expression pattern (expression) are stored inRegExpThe object'sPatternin the attribute.

Components of regular expressions can be a single character, a set of characters, a range of characters, a choice between characters, or any combination of all of these components.