RegExp.$n
syntax: |
RegExp.$n |
description: |
The text matched by the nth group, that is, the nth sub pattern in parenthesis. The numbering corresponds to \n, back references in patterns, and $n, substitutions in replacement patterns.
Read-only property.
|
see: |
Regular expression reference characters, regular expression replacement characters
|
example: |
var str = "one two three two one"; var pat = /(t.o)\s/ str.match(pat) // RegExp.$1 == "two" |