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.Test Method

Syntax

RegExp.Test(string)
string

Use: Required

Data Type: String

The string to be searched.

Return Value

A Boolean indicating whether a match was found.

Description

Performs a regular expression search against string and indicates whether a match was found

Rules at a Glance

  • Prior to calling the Test method, the search string should be defined by setting the Pattern property.

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

  • The method returns True if the search succeeds and False otherwise.

Programming Tips and Gotchas

  • Since a search is successful if one match is found, you do not have to set the RegExp object’s Global property before calling the Test method.

  • You can use the method to determine whether a match exists before calling either the Execute or the Replace methods.

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