|
272 | 272 | ('(a)b(c)', 'abc', SUCCEED, 'found+"-"+g1+"-"+g2', 'abc-a-c'), |
273 | 273 | ('a+b+c', 'aabbabc', SUCCEED, 'found', 'abc'), |
274 | 274 | ('a{1,}b{1,}c', 'aabbabc', SUCCEED, 'found', 'abc'), |
275 | | - #('a**', '-', SYNTAX_ERROR), |
| 275 | + ('a**', '-', SYNTAX_ERROR), |
276 | 276 | ('a.+?c', 'abcabc', SUCCEED, 'found', 'abc'), |
277 | 277 | ('(a+|b)*', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'), |
278 | 278 | ('(a+|b){0,}', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'), |
|
317 | 317 | # Python does not have the same rules for \\41 so this is a syntax error |
318 | 318 | # ('((((((((((a))))))))))\\41', 'aa', FAIL), |
319 | 319 | # ('((((((((((a))))))))))\\41', 'a!', SUCCEED, 'found', 'a!'), |
| 320 | + ('((((((((((a))))))))))\\41', '', SYNTAX_ERROR), |
320 | 321 | ('(((((((((a)))))))))', 'a', SUCCEED, 'found', 'a'), |
321 | 322 | ('multiple words of text', 'uh-uh', FAIL), |
322 | 323 | ('multiple words', 'multiple words, yeah', SUCCEED, 'found', 'multiple words'), |
|
400 | 401 | ('(?i)(a)b(c)', 'ABC', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABC-A-C'), |
401 | 402 | ('(?i)a+b+c', 'AABBABC', SUCCEED, 'found', 'ABC'), |
402 | 403 | ('(?i)a{1,}b{1,}c', 'AABBABC', SUCCEED, 'found', 'ABC'), |
403 | | - #('(?i)a**', '-', SYNTAX_ERROR), |
| 404 | + ('(?i)a**', '-', SYNTAX_ERROR), |
404 | 405 | ('(?i)a.+?c', 'ABCABC', SUCCEED, 'found', 'ABC'), |
405 | 406 | ('(?i)a.*?c', 'ABCABC', SUCCEED, 'found', 'ABC'), |
406 | 407 | ('(?i)a.{0,5}?c', 'ABCABC', SUCCEED, 'found', 'ABC'), |
|
447 | 448 | ('(?i)((((((((((a))))))))))\\10', 'AA', SUCCEED, 'found', 'AA'), |
448 | 449 | #('(?i)((((((((((a))))))))))\\41', 'AA', FAIL), |
449 | 450 | #('(?i)((((((((((a))))))))))\\41', 'A!', SUCCEED, 'found', 'A!'), |
| 451 | + ('(?i)((((((((((a))))))))))\\41', '', SYNTAX_ERROR), |
450 | 452 | ('(?i)(((((((((a)))))))))', 'A', SUCCEED, 'found', 'A'), |
451 | 453 | ('(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))', 'A', SUCCEED, 'g1', 'A'), |
452 | 454 | ('(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))', 'C', SUCCEED, 'g1', 'C'), |
|
474 | 476 |
|
475 | 477 | ('w(?# comment', 'w', SYNTAX_ERROR), |
476 | 478 | ('w(?# comment 1)xy(?# comment 2)z', 'wxyz', SUCCEED, 'found', 'wxyz'), |
| 479 | + |
| 480 | + # Check odd placement of embedded pattern modifiers |
| 481 | + |
| 482 | + ('w(?i)', 'W', SYNTAX_ERROR), |
477 | 483 |
|
478 | | - # Comments using the x embedded pattern modifier (in an unusual place too) |
| 484 | + # Comments using the x embedded pattern modifier |
479 | 485 |
|
480 | | - ("""w# comment 1 |
481 | | - x(?x) y |
| 486 | + ("""(?x)w# comment 1 |
| 487 | + x y |
482 | 488 | # comment 2 |
483 | 489 | z""", 'wxyz', SUCCEED, 'found', 'wxyz'), |
484 | 490 |
|
|
491 | 497 | abc |
492 | 498 | xyz""", SUCCEED, 'found', 'abc'), |
493 | 499 |
|
| 500 | + ('(?m)abc$', """jkl |
| 501 | +xyzabc |
| 502 | +123""", SUCCEED, 'found', 'abc'), |
| 503 | + |
494 | 504 | # using the s embedded pattern modifier |
495 | 505 |
|
496 | 506 | ('a.b', 'a\nb', FAIL), |
497 | 507 | ('(?s)a.b', 'a\nb', SUCCEED, 'found', 'a\nb'), |
| 508 | + |
| 509 | + # test \w, etc. |
| 510 | + |
| 511 | + ('\\w+', '--ab_cd0123--', SUCCEED, 'found', 'ab_cd0123'), |
| 512 | + ('\\D+', '1234abc5678', SUCCEED, 'found', 'abc'), |
| 513 | + ('[\\da-fA-F]+', '123abc', SUCCEED, 'found', '123abc'), |
| 514 | + ('[\\d-x]', '-', SYNTAX_ERROR), |
498 | 515 | ] |
0 commit comments