By registering with us, you'll be able to discuss, share and private message with other members of our community.
Sign up now!public static Pattern getPatternForExactString(final String string) {
String pattern = "^";
for (char c : string.toCharArray()) {
if (c == '(' || c == ')' || c == '^' || c == '$'|| c == '.' || c == '*' || c == '?' || c == '|'|| c == '[' || c == '{') {
pattern += "\\";
}
pattern += c;
}
pattern += "$";
return Pattern.compile(pattern);
}
What about the closing braces and brackets?For the next release, does this check out to you?
Code:public static Pattern getPatternForExactString(final String string) { String pattern = "^"; for (char c : string.toCharArray()) { if (c == '(' || c == ')' || c == '^' || c == '$'|| c == '.' || c == '*' || c == '?' || c == '|'|| c == '[' || c == '{') { pattern += "\\"; } pattern += c; } pattern += "$"; return Pattern.compile(pattern); }
While that's true, it's could cause problems in other areas.You could use IDs instead of names anyway since SpriteItem IDs dont change
Plus you'd have to gather all of the IDs, which would be a dragWhile that's true, it's could cause problems in other areas.
From my research, those only need to be escaped when the prior opening isn't escaped.What about the closing braces and brackets?
Yeah, but I really don't recommend that.You could use IDs instead of names anyway since SpriteItem IDs dont change
We use essential cookies to make this site work, and optional cookies to enhance your experience.