blob: 933e623a677894f1381d8d0f420f252872d93e1e [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: Invalid regular expression: missing /.
PASS /a\/ threw exception SyntaxError: Invalid regular expression: missing /.
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: Invalid or unexpected token.
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: /(/: Unterminated group.
PASS /a(/ threw exception SyntaxError: Invalid regular expression: /a(/: Unterminated group.
Testing regexp: [invalid ) variations]
PASS /)/ threw exception SyntaxError: Invalid regular expression: /)/: Unmatched ')'.
PASS /a)/ threw exception SyntaxError: Invalid regular expression: /a)/: Unmatched ')'.
Testing regexp: [invalid [ variations]
PASS /[/ threw exception SyntaxError: Invalid regular expression: missing /.
PASS /a[/ threw exception SyntaxError: Invalid regular expression: missing /.
PASS /[b-a]/ threw exception SyntaxError: Invalid regular expression: /[b-a]/: Range out of order in character class.
PASS /a[b-a]/ threw exception SyntaxError: Invalid regular expression: /a[b-a]/: 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: /{0}/: Nothing to repeat.
PASS /{1,0}/ threw exception SyntaxError: Invalid regular expression: /{1,0}/: Nothing to repeat.
PASS /a{1,0}/ threw exception SyntaxError: Invalid regular expression: /a{1,0}/: 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