Commit 1e420c8
Fix regex /i flag to not affect Unicode properties
In Perl, the /i flag makes matching case-insensitive for literals,
but does NOT affect Unicode property matching (\p{...}).
Changes:
- RegexPreprocessorHelper: Wrap \p{...} translations in (?-i:...) to
disable case-insensitive matching for property references
- RegexPreprocessor: Skip over \p{...}, \P{...}, \N{...}, \x{...},
\o{...} constructs during case-fold expansion to prevent mangling
property names (e.g., 'k' in 'Blk' was being expanded)
- ExtendedCharClass: Wrap output in (?-i:...) since Perl's (?[...])
applies /i only to literals, not Unicode properties
This fixes re/regex_sets.t tests 26-27 and enables many more tests
to pass (79/88 up from 25/88).
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent 8d45476 commit 1e420c8
3 files changed
Lines changed: 28 additions & 2 deletions
File tree
- src/main/java/org/perlonjava/runtime/regex
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
83 | 89 | | |
84 | 90 | | |
85 | 91 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
354 | 372 | | |
355 | 373 | | |
356 | 374 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
324 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
325 | 327 | | |
326 | 328 | | |
327 | 329 | | |
| |||
0 commit comments