
Wildcard in custom filters is broken
bmwalter68 opened this issue ยท 3 comments
Commit 5b1cc7d breaks wildcards by forcing the returned pattern to be literal. If I type into my filter '*sword' you convert this to the regex friendly '.*sword' but Pattern.quote makes the pattern '\Q.*sword\E' which will literally only match the characters '.*sword' because the pattern is interpreted literally.
I'm assuming that you did this to remove the ambiguity of all of the rest of the wierd regex rules like parens, square brackets etc. but Pattern.quote won't cut it for that. You'd need to look at all of the other offending things like []{}? and replace them with quoted versions.
Looking back at the commit message, it was to prevent a server crash. You could accomplish this by wrapping the pattern compilation in a try/catch and logging the bad patterns instead.
Honestly, I'd love to see a regex filter in addition to a simple strings based filter ;)