Skip to content

Refactor: use String.replace instead of replaceAll#3356

Open
kn4tti wants to merge 1 commit into
spring-projects:mainfrom
kn4tti:refactor/replace-pattern
Open

Refactor: use String.replace instead of replaceAll#3356
kn4tti wants to merge 1 commit into
spring-projects:mainfrom
kn4tti:refactor/replace-pattern

Conversation

@kn4tti
Copy link
Copy Markdown

@kn4tti kn4tti commented Apr 22, 2026

Summary

Use String#replace instead of String#replaceAll for simple, non-regex replacements in PathIndexResolver to avoid unnecessary regex overhead and clarify the intent.

Details

  • For map properties, replace
    path.replaceAll("\[", "").replaceAll("\]", "")
    with
    path.replace("[", "").replace("]", "").
  • For collection-like properties, keep the regex-based index removal but replace the non-regex ".." handling:
    path.replaceAll("\[(\p{Digit})\]", "").replaceAll("\.\.", ".")
    becomes
    path.replaceAll("\[(\p{Digit})
    \]", "").replace("..", ".").

This change is intended to be behavior-preserving while simplifying the implementation and avoiding regex processing where it is not required.

Testing

  • Existing tests continue to pass.

Signed-off-by: kn4tti <gaden119000@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 22, 2026
@mp911de mp911de self-assigned this Jun 1, 2026
@mp911de mp911de added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: task A general task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants