Fix ReleaseInfo.clean issues

This commit is contained in:
Reinhard Pointner 2016-11-20 12:20:17 +08:00
parent 3779d48afa
commit 4d83f04812
2 changed files with 5 additions and 1 deletions

View File

@ -336,7 +336,7 @@ public class ReleaseInfo {
String group = "((?<!\\p{Alnum})" + or(releaseGroup.get()) + "(?!\\p{Alnum})[\\p{Punct}]??)+";
// group pattern at beginning or ending of the string
String[] groupHeadTail = { "(?<=^[^\\p{Alnum}]*)" + group, group + "(?=[\\p{Alpha}\\p{Punct}]*$)" };
String[] groupHeadTail = { "(?<=^[\\P{Alnum}]*)" + group, group + "(?=[\\P{Alnum}]*$)" };
return compile(or(groupHeadTail), strict ? 0 : CASE_INSENSITIVE);
}

View File

@ -1,6 +1,7 @@
package net.filebot.media;
import static java.util.Collections.*;
import static org.junit.Assert.*;
import java.util.regex.Pattern;
@ -41,6 +42,9 @@ public class ReleaseInfoTest {
assertEquals("DVL", info.getReleaseGroup("Movie-DVL"));
assertEquals("iMBT", info.getReleaseGroup("The.Legend.Of.Zorro-iMBT"));
assertEquals("[The Legend of the Blue Sea]", info.cleanRelease(singleton("The.Legend.of.the.Blue.Sea.E01"), false).toString());
assertEquals("[The Legend of the Blue Sea]", info.cleanRelease(singleton("[Legend].The.Legend.of.the.Blue.Sea.E01-Legend"), false).toString());
}
@Test