"RegExp" Class and Object for Regular Expression Support

This section describes the 'RegExp' class and objects used for pattern matches using regular expressions. oRegExp.execute(string) returns a MatchCollection collection object.

VBScript supports a built-in class called "RegExp" to provide regular expression support.

In order to perform a regular express task, you need to create a RegExp object with this syntax:

   Set oRegExp = New RegExp

Note that we have to use the "Set" statement to assign an object to a variable.

Then we are ready to use properties and methods supported on the RegExp object, oRegExp:

The Match object has the following properties:

Notice that MatchCollection and SubMatches objects are collection objects. They share same properties and methods as all collection objects. See the next section for details.

Table of Contents

 About This Book

 Introduction of VBScript - Visual Basic Scripting Edition

 Variant Data Type, Subtypes, and Literals

 Arithmetic Operations

 Numeric Comparison Operations and Logical Operations

 String Operations - Concatenation and Comparison

 Variable Declaration and Assignment Statement

 Expression and Order of Operation Precedence

 Statement Syntax and Statement Types

 Array Data Type and Related Statements

 Array References and Array Assignment Statements

 Conditional Statements - "If ... Then" and "Select Case"

 Loop Statements - "For", "While", and "Do"

 "Function" and "Sub" Procedures

 Built-in Functions

 Inspecting Variables Received in Procedures

 Error Handling Flag and the "Err" Object

Regular Expression Pattern Match and Replacement

"RegExp" Class and Object for Regular Expression Support

 "MatchCollection" and "SubMatches" Collection Objects

 "Set oRegExp = New RegExp" - Creating RegExp Objects

 Example of Regular Expression Match and Replacement

 scrrun.dll - Scripting Runtime DLL Library

 Creating Your Own Classes

 IE Web Browser Supporting VBScript

 IIS ASP Server Supporting VBScript

 WSH (Windows Script Host)

 References

 Full Version in PDF/EPUB