Skip to content

WildHostMatcher doesn't escape square brackets ([, ]) #381

@blablabla42

Description

@blablabla42

The WildHostMatcher escapes a number of characters before interpreting it as a regex. It should also escape square brackets, or else the regex will be misinterpreted.

For example, [foo.com]:2222 will be interpreted as the regex "match any of characters f, o, o... once" instead of the string "foo.com".

You may also want to assert that the regex contains the whole string, by anchoring the start and the end. Something like this instead:

Pattern pat = Pattern.compile("^" + hostEntry.replace(".", "\\.").replace("*", ".*").replace("?", ".")) + "$")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions