Fixed: a after a shortened word is not removed correctly for matching. Fixes ##3487

pull/3515/head
Leonardo Galli 5 years ago
parent 5faaffc9c6
commit 7756b03555

@ -25,6 +25,8 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("test/test", "testtest")]
[TestCase("90210", "90210")]
[TestCase("24", "24")]
[TestCase("I'm a cyborg, but that's OK", "imcyborgbutthatsok")]
[TestCase("Im a cyborg, but thats ok", "imcyborgbutthatsok")]
public void should_remove_special_characters_and_casing(string dirty, string clean)
{
var result = dirty.CleanSeriesTitle();

@ -90,7 +90,7 @@ namespace NzbDrone.Core.Parser
//Regex to detect whether the title was reversed.
private static readonly Regex ReversedTitleRegex = new Regex(@"(?:^|[-._ ])(p027|p0801)[-._ ]", RegexOptions.Compiled);
private static readonly Regex NormalizeRegex = new Regex(@"((?:\b|_)(?<!^|\W\w\W)(a(?!$|\W\w\W)|an|the|and|or|of)(?:\b|_))|\W|_",
private static readonly Regex NormalizeRegex = new Regex(@"((?:\b|_)(?<!^|[^a-zA-Z0-9_']\w[^a-zA-Z0-9_'])(a(?!$|[^a-zA-Z0-9_']\w[^a-zA-Z0-9_'])|an|the|and|or|of)(?:\b|_))|\W|_",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex FileExtensionRegex = new Regex(@"\.[a-z0-9]{2,4}$",

Loading…
Cancel
Save