Skip to content

fix: improve KeyPattern.NAMESPACE_PATTERN regex#1436

Open
Keksnet wants to merge 1 commit into
PaperMC:main/5from
Keksnet:bugfix/keypattern-namespace-regex
Open

fix: improve KeyPattern.NAMESPACE_PATTERN regex#1436
Keksnet wants to merge 1 commit into
PaperMC:main/5from
Keksnet:bugfix/keypattern-namespace-regex

Conversation

@Keksnet

@Keksnet Keksnet commented Jul 19, 2026

Copy link
Copy Markdown

Hi,
this PR aims to fix #1435.
I removed the ^ and $ at the start and end of the regex respectively as they are already enforced by the usages of the regex itself. The regex is not used in a way that it could only match a part of the pattern.
If I only remove those the regex would match .. again as valid to prevent that I added a non-capturing group inside the negative lookahead to make it compatible with a full key of the form namespace:value.
This non-capturing group does accept the end of the line or a colon as the end the namespace and therefore works either for matching the namespace or a full key.
All tests still pass and the warnings for @KeyPattern align with the expected test results as far as I can tell.

Any feedback is welcome 🙂

@kezz kezz added this to the 5.3.0 milestone Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@KeyPattern regex broke due to update to @KeyPattern.Namespace regex

2 participants