번역이 완료되지 않았습니다. Please help translate this article from English
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
비표준 $1, $2, $3, $4, $5, $6, $7, $8, $9 속성들은 정적이며, 괄호로 묶인 하위 문자열 match들을 포함하는 정규 표현식의 읽기 전용 속성들입니다.
RegExp.$1 RegExp.$2RegExp.$3 RegExp.$4 RegExp.$5 RegExp.$6 RegExp.$7 RegExp.$8 RegExp.$9
$1, ..., $9 properties are static, they are not a property of an individual regular expression object. Instead, you always use them as
The values of these properties are read-only and modified whenever successful matches are made.
The number of possible parenthesized substrings is unlimited, but the
RegExp object can only hold the first nine. You can access all parenthesized substrings through the returned array's indexes.
These properties can be used in the replacement text for the
String.replace method. When used this way, do not prepend them with
RegExp. The example below illustrates this. When parentheses are not included in the regular expression, the script interprets
$n's literally (where
n is a positive integer).
var re = /(\w+)\s(\w+)/; var str = 'John Smith'; str.replace(re, '$2, $1'); // "Smith, John" RegExp.$1; // "John" RegExp.$2; // "Smith"
Non-standard. Not part of any current specification.
|Chrome Full support 1||Edge Full support 12||Firefox Full support 1||IE Full support 4||Opera Full support 5||Safari Full support 1||WebView Android Full support 1||Chrome Android Full support 18||Firefox Android Full support 4||Opera Android Full support 10.1||Safari iOS Full support 1||Samsung Internet Android Full support 1.0||nodejs Full support Yes|
- Full support
- Full support