@@ -368,16 +368,28 @@ it("line: 49 - matches ^(abc){1,2}zz against 'abcabcabczz'", () => {
368
368
it ( "line: 50 - matches ^(abc){1,2}zz against '>>abczz'" , ( ) => {
369
369
expectNotMatch ( "^(abc){1,2}zz" , [ ">>abczz" ] ) ;
370
370
} ) ;
371
- xit ( "line: 51 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
372
- xit ( "line: 52 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
373
- xit ( "line: 53 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
374
- xit ( "line: 54 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
375
- xit ( "line: 55 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
376
- xit ( "line: 56 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
377
- xit ( "line: 57 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
378
- xit ( "line: 58 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
379
- xit ( "line: 59 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
380
- xit ( "line: 60 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
371
+ it ( "line: 51 - matches ^(b+?|a){1,2}?c against 'bc'" , ( ) => {
372
+ const match = exec ( "^(b+?|a){1,2}?c" , "bc" , "s" ) ;
373
+ expect ( match . matches [ 0 ] ) . toBe ( "bc" . substring ( 0 , 2 ) ) ;
374
+ expect ( match . matches [ 1 ] ) . toBe ( "bc" . substring ( 0 , 1 ) ) ;
375
+ } ) ;
376
+ xit ( "line: 52 - issues with repeated capture groups" , ( ) => { } ) ;
377
+ xit ( "line: 53 - issues with repeated capture groups" , ( ) => { } ) ;
378
+ xit ( "line: 54 - issues with repeated capture groups" , ( ) => { } ) ;
379
+ xit ( "line: 55 - issues with repeated capture groups" , ( ) => { } ) ;
380
+ it ( "line: 56 - matches ^(b+?|a){1,2}?c against 'aac'" , ( ) => {
381
+ const match = exec ( "^(b+?|a){1,2}?c" , "aac" , "s" ) ;
382
+ expect ( match . matches [ 0 ] ) . toBe ( "aac" . substring ( 0 , 3 ) ) ;
383
+ expect ( match . matches [ 1 ] ) . toBe ( "aac" . substring ( 1 , 2 ) ) ;
384
+ } ) ;
385
+ xit ( "line: 57 - issues with repeated capture groups" , ( ) => { } ) ;
386
+ xit ( "line: 58 - issues with repeated capture groups" , ( ) => { } ) ;
387
+ it ( "line: 59 - matches ^(b+?|a){1,2}?c against 'aaac'" , ( ) => {
388
+ expectNotMatch ( "^(b+?|a){1,2}?c" , [ "aaac" ] ) ;
389
+ } ) ;
390
+ it ( "line: 60 - matches ^(b+?|a){1,2}?c against 'abbbbbbbbbbbac'" , ( ) => {
391
+ expectNotMatch ( "^(b+?|a){1,2}?c" , [ "abbbbbbbbbbbac" ] ) ;
392
+ } ) ;
381
393
it ( "line: 61 - matches ^(b+|a){1,2}c against 'bc'" , ( ) => {
382
394
const match = exec ( "^(b+|a){1,2}c" , "bc" , "s" ) ;
383
395
expect ( match . matches [ 0 ] ) . toBe ( "bc" . substring ( 0 , 2 ) ) ;
@@ -400,17 +412,41 @@ it("line: 69 - matches ^(b+|a){1,2}c against 'aaac'", () => {
400
412
it ( "line: 70 - matches ^(b+|a){1,2}c against 'abbbbbbbbbbbac'" , ( ) => {
401
413
expectNotMatch ( "^(b+|a){1,2}c" , [ "abbbbbbbbbbbac" ] ) ;
402
414
} ) ;
403
- xit ( "line: 71 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
404
- xit ( "line: 72 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
405
- xit ( "line: 73 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
406
- xit ( "line: 74 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
407
- xit ( "line: 75 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
408
- xit ( "line: 76 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
409
- xit ( "line: 77 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
410
- xit ( "line: 78 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
411
- xit ( "line: 79 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
412
- xit ( "line: 80 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
413
- xit ( "line: 81 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
415
+ it ( "line: 71 - matches ^(b+|a){1,2}?bc against 'bbc'" , ( ) => {
416
+ const match = exec ( "^(b+|a){1,2}?bc" , "bbc" , "s" ) ;
417
+ expect ( match . matches [ 0 ] ) . toBe ( "bbc" . substring ( 0 , 3 ) ) ;
418
+ expect ( match . matches [ 1 ] ) . toBe ( "bbc" . substring ( 0 , 1 ) ) ;
419
+ } ) ;
420
+ xit ( "line: 72 - issues with repeated capture groups" , ( ) => { } ) ;
421
+ xit ( "line: 73 - issues with repeated capture groups" , ( ) => { } ) ;
422
+ it ( "line: 74 - matches ^(b*|ba){1,2}?bc against 'bababc'" , ( ) => {
423
+ const match = exec ( "^(b*|ba){1,2}?bc" , "bababc" , "s" ) ;
424
+ expect ( match . matches [ 0 ] ) . toBe ( "bababc" . substring ( 0 , 6 ) ) ;
425
+ expect ( match . matches [ 1 ] ) . toBe ( "bababc" . substring ( 2 , 4 ) ) ;
426
+ } ) ;
427
+ it ( "line: 75 - matches ^(b*|ba){1,2}?bc against 'bababbc'" , ( ) => {
428
+ expectNotMatch ( "^(b*|ba){1,2}?bc" , [ "bababbc" ] ) ;
429
+ } ) ;
430
+ it ( "line: 76 - matches ^(b*|ba){1,2}?bc against 'babababc'" , ( ) => {
431
+ expectNotMatch ( "^(b*|ba){1,2}?bc" , [ "babababc" ] ) ;
432
+ } ) ;
433
+ it ( "line: 77 - matches ^(ba|b*){1,2}?bc against 'babc'" , ( ) => {
434
+ const match = exec ( "^(ba|b*){1,2}?bc" , "babc" , "s" ) ;
435
+ expect ( match . matches [ 0 ] ) . toBe ( "babc" . substring ( 0 , 4 ) ) ;
436
+ expect ( match . matches [ 1 ] ) . toBe ( "babc" . substring ( 0 , 2 ) ) ;
437
+ } ) ;
438
+ xit ( "line: 78 - issues with repeated capture groups" , ( ) => { } ) ;
439
+ it ( "line: 79 - matches ^(ba|b*){1,2}?bc against 'bababc'" , ( ) => {
440
+ const match = exec ( "^(ba|b*){1,2}?bc" , "bababc" , "s" ) ;
441
+ expect ( match . matches [ 0 ] ) . toBe ( "bababc" . substring ( 0 , 6 ) ) ;
442
+ expect ( match . matches [ 1 ] ) . toBe ( "bababc" . substring ( 2 , 4 ) ) ;
443
+ } ) ;
444
+ it ( "line: 80 - matches ^(ba|b*){1,2}?bc against 'bababbc'" , ( ) => {
445
+ expectNotMatch ( "^(ba|b*){1,2}?bc" , [ "bababbc" ] ) ;
446
+ } ) ;
447
+ it ( "line: 81 - matches ^(ba|b*){1,2}?bc against 'babababc'" , ( ) => {
448
+ expectNotMatch ( "^(ba|b*){1,2}?bc" , [ "babababc" ] ) ;
449
+ } ) ;
414
450
xit ( "line: 82 - test regex contains syntax not supported in JS" , ( ) => { } ) ;
415
451
it ( "line: 83 - matches ^[ab\\]cde] against 'athing'" , ( ) => {
416
452
const match = exec ( "^[ab\\]cde]" , "athing" , "s" ) ;
@@ -1120,11 +1156,26 @@ it("line: 244 - matches ^[aeiou\\d]{4,5}$ against 'aaaaa'", () => {
1120
1156
it ( "line: 245 - matches ^[aeiou\\d]{4,5}$ against '123456'" , ( ) => {
1121
1157
expectNotMatch ( "^[aeiou\\d]{4,5}$" , [ "123456" ] ) ;
1122
1158
} ) ;
1123
- xit ( "line: 246 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
1124
- xit ( "line: 247 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
1125
- xit ( "line: 248 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
1126
- xit ( "line: 249 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
1127
- xit ( "line: 250 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
1159
+ it ( "line: 246 - matches ^[aeiou\\d]{4,5}? against 'uoie'" , ( ) => {
1160
+ const match = exec ( "^[aeiou\\d]{4,5}?" , "uoie" , "s" ) ;
1161
+ expect ( match . matches [ 0 ] ) . toBe ( "uoie" . substring ( 0 , 4 ) ) ;
1162
+ } ) ;
1163
+ it ( "line: 247 - matches ^[aeiou\\d]{4,5}? against '1234'" , ( ) => {
1164
+ const match = exec ( "^[aeiou\\d]{4,5}?" , "1234" , "s" ) ;
1165
+ expect ( match . matches [ 0 ] ) . toBe ( "1234" . substring ( 0 , 4 ) ) ;
1166
+ } ) ;
1167
+ it ( "line: 248 - matches ^[aeiou\\d]{4,5}? against '12345'" , ( ) => {
1168
+ const match = exec ( "^[aeiou\\d]{4,5}?" , "12345" , "s" ) ;
1169
+ expect ( match . matches [ 0 ] ) . toBe ( "12345" . substring ( 0 , 4 ) ) ;
1170
+ } ) ;
1171
+ it ( "line: 249 - matches ^[aeiou\\d]{4,5}? against 'aaaaa'" , ( ) => {
1172
+ const match = exec ( "^[aeiou\\d]{4,5}?" , "aaaaa" , "s" ) ;
1173
+ expect ( match . matches [ 0 ] ) . toBe ( "aaaaa" . substring ( 0 , 4 ) ) ;
1174
+ } ) ;
1175
+ it ( "line: 250 - matches ^[aeiou\\d]{4,5}? against '123456'" , ( ) => {
1176
+ const match = exec ( "^[aeiou\\d]{4,5}?" , "123456" , "s" ) ;
1177
+ expect ( match . matches [ 0 ] ) . toBe ( "123456" . substring ( 0 , 4 ) ) ;
1178
+ } ) ;
1128
1179
xit ( "line: 251 - back references are not supported" , ( ) => { } ) ;
1129
1180
xit ( "line: 252 - back references are not supported" , ( ) => { } ) ;
1130
1181
xit ( "line: 253 - back references are not supported" , ( ) => { } ) ;
@@ -1182,8 +1233,16 @@ xit("line: 287 - non capturing groups not supported", () => {});
1182
1233
xit ( "line: 288 - non capturing groups not supported" , ( ) => { } ) ;
1183
1234
xit ( "line: 289 - non capturing groups not supported" , ( ) => { } ) ;
1184
1235
xit ( "line: 290 - the test behaviour differs between PCRE and JS" , ( ) => { } ) ;
1185
- xit ( "line: 291 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
1186
- xit ( "line: 292 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
1236
+ it ( "line: 291 - matches ^[ab]{1,3}?(ab*|b) against 'aabbbbb'" , ( ) => {
1237
+ const match = exec ( "^[ab]{1,3}?(ab*|b)" , "aabbbbb" , "s" ) ;
1238
+ expect ( match . matches [ 0 ] ) . toBe ( "aabbbbb" . substring ( 0 , 7 ) ) ;
1239
+ expect ( match . matches [ 1 ] ) . toBe ( "aabbbbb" . substring ( 1 , 7 ) ) ;
1240
+ } ) ;
1241
+ it ( "line: 292 - matches ^[ab]{1,3}?(ab*?|b) against 'aabbbbb'" , ( ) => {
1242
+ const match = exec ( "^[ab]{1,3}?(ab*?|b)" , "aabbbbb" , "s" ) ;
1243
+ expect ( match . matches [ 0 ] ) . toBe ( "aabbbbb" . substring ( 0 , 2 ) ) ;
1244
+ expect ( match . matches [ 1 ] ) . toBe ( "aabbbbb" . substring ( 1 , 2 ) ) ;
1245
+ } ) ;
1187
1246
it ( "line: 293 - matches ^[ab]{1,3}(ab*?|b) against 'aabbbbb'" , ( ) => {
1188
1247
const match = exec ( "^[ab]{1,3}(ab*?|b)" , "aabbbbb" , "s" ) ;
1189
1248
expect ( match . matches [ 0 ] ) . toBe ( "aabbbbb" . substring ( 0 , 4 ) ) ;
@@ -1503,7 +1562,10 @@ it("line: 1224 - matches a{0}bc against 'bc'", () => {
1503
1562
const match = exec ( "a{0}bc" , "bc" , "s" ) ;
1504
1563
expect ( match . matches [ 0 ] ) . toBe ( "bc" . substring ( 0 , 2 ) ) ;
1505
1564
} ) ;
1506
- xit ( "line: 1225 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
1565
+ it ( "line: 1225 - matches (a|(bc)){0,0}?xyz against 'xyz'" , ( ) => {
1566
+ const match = exec ( "(a|(bc)){0,0}?xyz" , "xyz" , "s" ) ;
1567
+ expect ( match . matches [ 0 ] ) . toBe ( "xyz" . substring ( 0 , 3 ) ) ;
1568
+ } ) ;
1507
1569
xit ( "line: 1226 - back references are not supported" , ( ) => { } ) ;
1508
1570
xit ( "line: 1227 - back references are not supported" , ( ) => { } ) ;
1509
1571
xit ( "line: 1228 - back references are not supported" , ( ) => { } ) ;
@@ -1617,8 +1679,26 @@ it("line: 1267 - matches [^az] against 'aaAabcd '", () => {
1617
1679
expect ( match . matches [ 0 ] ) . toBe ( "aaAabcd " . substring ( 4 , 5 ) ) ;
1618
1680
} ) ;
1619
1681
xit ( "line: 1268 - back references are not supported" , ( ) => { } ) ;
1620
- xit ( "line: 1269 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
1621
- xit ( "line: 1270 - lazy range repitition quantifiers are not supported" , ( ) => { } ) ;
1682
+ it ( "line: 1269 - matches P[^*]TAIRE[^*]{1,6}?LL against 'xxxxxxxxxxxPSTAIREISLLxxxxxxxxx'" , ( ) => {
1683
+ const match = exec (
1684
+ "P[^*]TAIRE[^*]{1,6}?LL" ,
1685
+ "xxxxxxxxxxxPSTAIREISLLxxxxxxxxx" ,
1686
+ "s"
1687
+ ) ;
1688
+ expect ( match . matches [ 0 ] ) . toBe (
1689
+ "xxxxxxxxxxxPSTAIREISLLxxxxxxxxx" . substring ( 11 , 22 )
1690
+ ) ;
1691
+ } ) ;
1692
+ it ( "line: 1270 - matches P[^*]TAIRE[^*]{1,}?LL against 'xxxxxxxxxxxPSTAIREISLLxxxxxxxxx'" , ( ) => {
1693
+ const match = exec (
1694
+ "P[^*]TAIRE[^*]{1,}?LL" ,
1695
+ "xxxxxxxxxxxPSTAIREISLLxxxxxxxxx" ,
1696
+ "s"
1697
+ ) ;
1698
+ expect ( match . matches [ 0 ] ) . toBe (
1699
+ "xxxxxxxxxxxPSTAIREISLLxxxxxxxxx" . substring ( 11 , 22 )
1700
+ ) ;
1701
+ } ) ;
1622
1702
it ( "line: 1271 - matches (\\.\\d\\d[1-9]?)\\d+ against '1.230003938'" , ( ) => {
1623
1703
const match = exec ( "(\\.\\d\\d[1-9]?)\\d+" , "1.230003938" , "s" ) ;
1624
1704
expect ( match . matches [ 0 ] ) . toBe ( "1.230003938" . substring ( 1 , 11 ) ) ;
0 commit comments