Microsoft® JScript™ match Method | Language Reference Version 3

See Also Applies To

##### Description

> Performs a search on a string using the supplied Regular Expression object.

##### Syntax

> stringObj.match(rgExp)

> The match method syntax has these parts:

> Part | Description
> stringObj | Required. The String object or literal on which to perform the search.
> rgExp | Required. The regular expression to use in the search.

##### Remarks

> The match method, which behaves like the exec method, returns an array of values. Element zero of the array contains the last matched characters. Elements 1...n contain matches to any parenthesized substrings in the regular expression.

> The method updates the contents of the RegExp object.

> The following example illustrates the use of the match method:

> >     function MatchDemo()
> >     {
> >       var r, re;
> >       var s = "The quick brown fox jumped over the lazy yellow dog.";
> >       re = /fox/i;
> >       r = s.match(re);
> >       return(r);
> >     }

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.