From 8563ae349fedede7860417cd9e42f4ac5c793d8a Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 5 Feb 2018 13:55:33 +0700 Subject: [PATCH] Reduce String.replacePart() false positive rate https://www.filebot.net/forums/viewtopic.php?f=5&t=4068&p=32229#p32229 --- source/net/filebot/format/ExpressionFormatMethods.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/net/filebot/format/ExpressionFormatMethods.java b/source/net/filebot/format/ExpressionFormatMethods.java index b97de455..da62e3ce 100644 --- a/source/net/filebot/format/ExpressionFormatMethods.java +++ b/source/net/filebot/format/ExpressionFormatMethods.java @@ -328,7 +328,7 @@ public class ExpressionFormatMethods { public static String replacePart(String self, String replacement) { // 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) { Matcher matcher = compile(pattern, CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS).matcher(self);