Microsoft® JScript™ $1...$9 Properties | Language Reference Version 3

See Also Applies To

##### Description

> Specifies the nine most-recently memorized portions found during pattern matching. Read-only.

##### Syntax

> RegExp.$n

> The n argument is a number between 1 and 9.

##### Remarks

> The value of the $1...$9 properties is modified whenever a successful parenthesized match is made. Any number of parenthesized substrings may be specified in a regular expression pattern, but only the nine most recent can be stored.

> The following example illustrates the use of the $1...$9 properties:

> >     function matchDemo()
> >     {
> >       var s;
> >       var re = new RegExp("d(b+)(d)","ig");
> >       var str = "cdbBdbsbdbdz";
> >       var arr = re.exec(str);
> >       s = "$1 contains: " + RegExp.$1 + "<BR>";
> >       s += "$2 contains: " + RegExp.$2 + "<BR>";
> >       s += "$3 contains: " + RegExp.$3;
> >       return(s);
> >     }

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