O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

RegExp.Execute Method

Syntax

RegExp.Execute(string)
string

Use: Required

Data Type: String

The string to be searched.

Return Value

A Matches collection containing one or more Match objects.

Description

Performs a regular expression search against string and returns the results in the Matches collection.

Rules at a Glance

  • The method searches string using the RegExp object’s Pattern property.

  • The results are returned in the Matches collection, which is a collection of Match objects.

  • If the search finds no matches, the Matches collection is empty.

Programming Tips and Gotchas

  • Remember to use the Set statement to assign the Matches collection returned by the Execute method to an object variable.

  • You can determine whether the Matches collection returned by the Execute method is empty by examining its Count property. It is empty if the value of Count is 0.

Example

See the example for the RegExp.Pattern Property.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required