Skip to content

fix(core): align char classes and escapes with java.util.regex. - #323

Merged
SimY4 merged 1 commit into
mainfrom
fix/char-classes
Nov 12, 2026
Merged

SimY4 merged 1 commit into
mainfrom
fix/char-classes

Conversation

@SimY4

@SimY4 SimY4 commented Nov 12, 2026

Copy link
Copy Markdown
Owner
  • . and negated classes ([^a], \D, \W, \S, \H, \V) cover all BMP chars except surrogates; negation is no longer affected by DOTALL/UNIX_LINES, so [^a] matches line terminators as in Pattern.
  • \s/\S include \x0B, \p{Space} is [ \t\n\x0B\f\r], \p{all} is any char, \p{javaLowerCase}, \p{javaUpperCase} and \p{javaWhitespace} use the respective Character predicates.
  • Support \h, \H, \v, \V, \f, \a, \e and \cX; previously parsed as literal letters, generating strings the pattern rejects.
  • Case-insensitive matching folds US-ASCII only unless UNICODE_CASE (or UNICODE_CHARACTER_CLASS) is set, as in Pattern.
  • Drop Lazy in favour of plain constants.

- `.` and negated classes (`[^a]`, `\D`, `\W`, `\S`, `\H`, `\V`) cover all BMP chars except surrogates; negation is no longer affected by DOTALL/UNIX_LINES, so `[^a]` matches line terminators as in Pattern.
- `\s`/`\S` include `\x0B`, `\p{Space}` is `[ \t\n\x0B\f\r]`, `\p{all}` is any char, `\p{javaLowerCase}`, `\p{javaUpperCase}` and `\p{javaWhitespace}` use the respective Character predicates.
- Support `\h`, `\H`, `\v`, `\V`, `\f`, `\a`, `\e` and `\cX`; previously parsed as literal letters, generating strings the pattern rejects.
- Case-insensitive matching folds US-ASCII only unless UNICODE_CASE (or UNICODE_CHARACTER_CLASS) is set, as in Pattern.
- Drop Lazy in favour of plain constants.
@SimY4
SimY4 merged commit 989d27d into main Nov 12, 2026
6 checks passed
@SimY4
SimY4 deleted the fix/char-classes branch November 12, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant