Skip to content

Conversation

@ewaostrowska
Copy link
Contributor

Description of the PR

  • replaceAll uses a backtracking engine. The pattern ([A-Z]+)([A-Z][a-z][a-z]+) had a greedy quantified group ([A-Z]+) followed by another subpattern that starts with an overlapping class [A-Z] and then [a-z][a-z]+. Inputs like "A...A a...a" (many uppercase, then many lowercase) could have had caused an issue.
  • String.replaceAll did compile the regex on each call. Using Pattern allows to compile regex once and reuse it.

The outcome of the method should be the same

@ewaostrowska ewaostrowska merged commit 92fcc81 into master Nov 5, 2025
11 checks passed
@ewaostrowska ewaostrowska deleted the oss-202 branch November 5, 2025 12:35
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.

4 participants