| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = 'RegExp_lastMatch.js'; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; |
| 17 |
var VERSION = 'no version'; |
| 18 |
startTest(); |
| 19 |
var TITLE = 'RegExp: lastMatch'; |
| 20 |
|
| 21 |
writeHeaderToLog('Executing script: RegExp_lastMatch.js'); |
| 22 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
'foo'.match(/foo/); |
| 27 |
new TestCase ( SECTION, "'foo'.match(/foo/); RegExp.lastMatch", |
| 28 |
'foo', RegExp.lastMatch); |
| 29 |
|
| 30 |
|
| 31 |
'foo'.match(new RegExp('foo')); |
| 32 |
new TestCase ( SECTION, "'foo'.match(new RegExp('foo')); RegExp.lastMatch", |
| 33 |
'foo', RegExp.lastMatch); |
| 34 |
|
| 35 |
|
| 36 |
'xxx'.match(/bar/); |
| 37 |
new TestCase ( SECTION, "'xxx'.match(/bar/); RegExp.lastMatch", |
| 38 |
'foo', RegExp.lastMatch); |
| 39 |
|
| 40 |
|
| 41 |
'xxx'.match(/$/); |
| 42 |
new TestCase ( SECTION, "'xxx'.match(/$/); RegExp.lastMatch", |
| 43 |
'', RegExp.lastMatch); |
| 44 |
|
| 45 |
|
| 46 |
'abcdefg'.match(/^..(cd)[a-z]+/); |
| 47 |
new TestCase ( SECTION, "'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch", |
| 48 |
'abcdefg', RegExp.lastMatch); |
| 49 |
|
| 50 |
|
| 51 |
'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); |
| 52 |
new TestCase ( SECTION, "'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\\1/); RegExp.lastMatch", |
| 53 |
'abcdefgabcdefg', RegExp.lastMatch); |
| 54 |
|
| 55 |
test(); |