MCPcopy Create free account
hub / github.com/nodejs/node / captureMatch

Function captureMatch

deps/v8/test/mjsunit/regexp-capture-3.js:57–71  ·  view source on GitHub ↗
(re)

Source from the content-addressed store, hash-verified

55}
56
57function captureMatch(re) {
58 "abcd".replace(re, function() { });
59 assertEquals("abcd", RegExp.input);
60 assertEquals("a", RegExp.leftContext);
61 assertEquals("bc", RegExp.lastMatch);
62 assertEquals("c", RegExp.lastParen);
63 assertEquals(undefined, RegExp.lastIndex);
64 assertEquals(undefined, RegExp.index);
65 assertEquals("d", RegExp.rightContext);
66 assertEquals('b', RegExp.$1);
67 assertEquals('c', RegExp.$2);
68 for (var i = 3; i < 10; i++) {
69 assertEquals("", RegExp['$' + i]);
70 }
71}
72
73captureMatch(/(b)(c)/);
74captureMatch(/(b)(c)/g);

Callers 1

Calls 1

assertEqualsFunction · 0.50

Tested by

no test coverage detected