Skip to content

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

Description

@Keksnet

Hey, I noticed a small bug with the regex pattern for the namespace pattern in @KeyPattern that was introduced in this commit.
The new regex now ends with a dollar sign which forces the end of the line after all characters matching the previous set were matched.
This matching behaviour works fine with the existing @KeyPattern.Namespace and @KeyPattern.Value annotations but it breaks the @KeyPattern. The regex for @KeyPattern consists of the namespace regex and the value regex. But due to the newline it wont match keys in the format namespace:value (e.g. minecraft:dirt) anymore.
This is because the full pattern now resolves to (?:(^(?!\.\.$)[a-z0-9_.-]+$:)?|:)[a-z0-9_\-.\/]+ which expects a end of line after the namespace. Because a namespace always has to be followed by a colon but also must end with the end of the line (according to the regex) this creates a condition which is impossible to fulfill.
I am currently already working on a fix for this and will open a PR as soon as I'm able to.
I only created this issue to document this as a known issue. 🙂

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions