Multiverse-Core

Multiverse-Core

6M Downloads

Why not use Pattern.quote(filter) in the "cleanFilter" method?

Qveshn opened this issue ยท 1 comments

commented

Please help me figure out the code.
I wonder why such a complex construct is used to escape characters instead of the simple actionPattern.quote(filter)?

protected String cleanFilter(String filter) {
return REGEX_SPECIAL_CHARS.matcher(filter).replaceAll("\\\\$0");
}

commented

Not sure what say. We just didn't think if that method of solving the issue when writing that part of the code, and I can tell you you probably going to find another 100 things that "why don't do another way" throughout the entire codebase. What we came up with achieve what it needs to do so nothing wrong there.

If you feel there is a reasonable improvement to codebase that you can make, feel free to PR.