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:
parent
0649adca00
commit
8563ae349f
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue