blob: d58bd2f314fa180a83499f1461e575922dc40b46 [file] [log] [blame]
This page tests handling of characters which, according to ECMA 262, are not regular expression PatternCharacters. Those characters are: ^ $ \ . * + ? ( ) [ ] { } |
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Testing regexp: /^/g
PASS regexp.test('') is true
PASS regexp.lastIndex is 0
Testing regexp: /\n^/gm
PASS regexp.test('\n\n') is true
PASS regexp.lastIndex is 1
Testing regexp: /$/g
PASS regexp.test('') is true
PASS regexp.lastIndex is 0
Testing regexp: /\n$/gm
PASS regexp.test('\n\n') is true
PASS regexp.lastIndex is 1
Testing regexp: /\z/
PASS regexp.test('z') is true
Testing regexp: /a\z/
PASS regexp.test('az') is true
Testing regexp: /\_/
PASS regexp.test('_') is true
Testing regexp: /a\_/
PASS regexp.test('a_') is true
Testing regexp: [invalid \ variations]
PASS /\/ threw exception SyntaxError: Unterminated regular expression literal '/\/'.
PASS /a\/ threw exception SyntaxError: Unterminated regular expression literal '/a\/'.
Testing regexp: /./
PASS regexp.test('a') is true
PASS regexp.test('\n') is false
Testing regexp: /a./
PASS regexp.test('aa') is true
PASS regexp.test('a\n') is false
Testing regexp: /a*/gm
PASS regexp.test('b') is true
PASS regexp.lastIndex is 0
PASS regexp.test('aaba') is true
PASS regexp.lastIndex is 2
Testing regexp: [invalid * variations]
PASS /*/ threw exception SyntaxError: Multiline comment was not closed properly.
PASS /^*/ threw exception SyntaxError: Invalid regular expression: nothing to repeat.
Testing regexp: /a+/gm
PASS regexp.test('b') is false
PASS regexp.test('aaba') is true
PASS regexp.lastIndex is 2
Testing regexp: [invalid + variations]
PASS /+/ threw exception SyntaxError: Invalid regular expression: nothing to repeat.
Testing regexp: /a?/gm
PASS regexp.test('b') is true
PASS regexp.lastIndex is 0
PASS regexp.test('aaba') is true
PASS regexp.lastIndex is 1
Testing regexp: [invalid ? variations]
PASS /?/ threw exception SyntaxError: Invalid regular expression: nothing to repeat.
Testing regexp: [invalid ( variations]
PASS /(/ threw exception SyntaxError: Invalid regular expression: missing ).
PASS /a(/ threw exception SyntaxError: Invalid regular expression: missing ).
Testing regexp: [invalid ) variations]
PASS /)/ threw exception SyntaxError: Invalid regular expression: unmatched parentheses.
PASS /a)/ threw exception SyntaxError: Invalid regular expression: unmatched parentheses.
Testing regexp: [invalid [ variations]
PASS /[/ threw exception SyntaxError: Unterminated regular expression literal '/[/'.
PASS /a[/ threw exception SyntaxError: Unterminated regular expression literal '/a[/'.
PASS /[b-a]/ threw exception SyntaxError: Invalid regular expression: range out of order in character class.
PASS /a[b-a]/ threw exception SyntaxError: Invalid regular expression: range out of order in character class.
Testing regexp: /]/gm
PASS regexp.test(']') is true
PASS regexp.lastIndex is 1
Testing regexp: /a]/gm
PASS regexp.test('a]') is true
PASS regexp.lastIndex is 2
Testing regexp: /{/gm
PASS regexp.test('{') is true
PASS regexp.lastIndex is 1
Testing regexp: /a{/gm
PASS regexp.test('a{') is true
PASS regexp.lastIndex is 2
Testing regexp: /{a/gm
PASS regexp.test('{a') is true
PASS regexp.lastIndex is 2
Testing regexp: /a{a/gm
PASS regexp.test('a{a') is true
PASS regexp.lastIndex is 3
Testing regexp: /{1,/gm
PASS regexp.test('{1,') is true
PASS regexp.lastIndex is 3
Testing regexp: /a{1,/gm
PASS regexp.test('a{1,') is true
PASS regexp.lastIndex is 4
Testing regexp: /{1,a/gm
PASS regexp.test('{1,a') is true
PASS regexp.lastIndex is 4
Testing regexp: /{1,0/gm
PASS regexp.test('{1,0') is true
PASS regexp.lastIndex is 4
Testing regexp: /{1, 0}/gm
PASS regexp.test('{1, 0}') is true
PASS regexp.lastIndex is 6
Testing regexp: /a{1, 0}/gm
PASS regexp.test('a{1, 0}') is true
PASS regexp.lastIndex is 7
Testing regexp: /a{1,0/gm
PASS regexp.test('a{1,0') is true
PASS regexp.lastIndex is 5
Testing regexp: /a{0}/gm
PASS regexp.test('a') is true
PASS regexp.lastIndex is 0
PASS regexp.test('b') is true
PASS regexp.lastIndex is 0
Testing regexp: [invalid {} variations]
PASS /{0}/ threw exception SyntaxError: Invalid regular expression: nothing to repeat.
PASS /{1,0}/ threw exception SyntaxError: Invalid regular expression: numbers out of order in {} quantifier.
PASS /a{1,0}/ threw exception SyntaxError: Invalid regular expression: numbers out of order in {} quantifier.
Testing regexp: /}/gm
PASS regexp.test('}') is true
PASS regexp.lastIndex is 1
Testing regexp: /a}/gm
PASS regexp.test('a}') is true
PASS regexp.lastIndex is 2
Testing regexp: /(?:)/gm
PASS regexp.test('') is true
PASS regexp.lastIndex is 0
Testing regexp: /|/gm
PASS regexp.test('|') is true
PASS regexp.lastIndex is 0
Testing regexp: /a|/gm
PASS regexp.test('|') is true
PASS regexp.lastIndex is 0
PASS successfullyParsed is true
TEST COMPLETE