YanoRyuichi.com/
Wiki
Blog
GitHub
Sandbox
開始行:
* キャプチャーしない括弧 (?:) [#y1987121]
var match = "XABX".match(/(A|B|C)/);
console.log(match);
console.log(match[1]);
[ 'A', 'A', index: 1, input: 'XABX', groups: undefined ]
A
- 普通に括弧(A|B|C)を使うと、キャプチャーされてmatch[1]に...
var match = "XAX".match(/(?:A|B|C)/);
console.log(match);
console.log(match[1]);
[ 'A', index: 1, input: 'XAX', groups: undefined ]
undefined
- 括弧(?:A|B|C)を使うと、キャプチャーされずmatch[1]はunde...
終了行:
* キャプチャーしない括弧 (?:) [#y1987121]
var match = "XABX".match(/(A|B|C)/);
console.log(match);
console.log(match[1]);
[ 'A', 'A', index: 1, input: 'XABX', groups: undefined ]
A
- 普通に括弧(A|B|C)を使うと、キャプチャーされてmatch[1]に...
var match = "XAX".match(/(?:A|B|C)/);
console.log(match);
console.log(match[1]);
[ 'A', index: 1, input: 'XAX', groups: undefined ]
undefined
- 括弧(?:A|B|C)を使うと、キャプチャーされずmatch[1]はunde...
ページ名: