diff --git a/source/net/filebot/media/ReleaseInfo.java b/source/net/filebot/media/ReleaseInfo.java index 419cf936..63c3f24c 100644 --- a/source/net/filebot/media/ReleaseInfo.java +++ b/source/net/filebot/media/ReleaseInfo.java @@ -168,7 +168,7 @@ public class ReleaseInfo { Pattern releaseGroup = getReleaseGroupPattern(strict); Pattern releaseGroupTrim = getReleaseGroupTrimPattern(); Pattern languageSuffix = getSubtitleLanguageTagPattern(languages); - Pattern languageTag = getLanguageTagPattern(languages); + Pattern languageTag = getLanguageTagPattern(languages, strict); Pattern videoSource = getVideoSourcePattern(); Pattern videoTags = getVideoTagPattern(); Pattern videoFormat = getVideoFormatPattern(strict); @@ -258,9 +258,15 @@ public class ReleaseInfo { return structureRootFolderPattern; } - public Pattern getLanguageTagPattern(Collection languages) { + public Pattern getLanguageTagPattern(Collection languages, boolean strict) { // [en] - return compile("(?<=[-\\[{(])" + or(quoteAll(languages)) + "(?=\\p{Punct})", CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS); + if (strict) { + return compile("(?<=[-\\[\\{\\(])" + or(quoteAll(languages)) + "(?=[-\\]\\}\\)]|$)", CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS); + } + + // FR + List allCapsLanguageTags = languages.stream().map(String::toUpperCase).collect(toList()); + return compile("(? languages) {