Reduce String.replacePart() false positive rate

https://www.filebot.net/forums/viewtopic.php?f=5&t=4068&p=32229#p32229
This commit is contained in:
Reinhard Pointner 2018-02-05 13:55:33 +07:00
parent 0649adca00
commit 8563ae349f
1 changed files with 1 additions and 1 deletions

View File

@ -328,7 +328,7 @@ public class ExpressionFormatMethods {
public static String replacePart(String self, String replacement) { public static String replacePart(String self, String replacement) {
// handle '(n)', '(Part n)' and ': Part n' like syntax // handle '(n)', '(Part n)' and ': Part n' like syntax
String[] patterns = new String[] { "\\s*[(](\\w+)[)]$", "\\W+Part (\\w+)\\W*$" }; String[] patterns = new String[] { "\\s*[(](\\w{1,3})[)]$", "\\W+Part (\\w+)\\W*$" };
for (String pattern : patterns) { for (String pattern : patterns) {
Matcher matcher = compile(pattern, CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS).matcher(self); Matcher matcher = compile(pattern, CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS).matcher(self);