diff --git a/src/NzbDrone.Core.Test/ParserTests/NormalizeTitleFixture.cs b/src/NzbDrone.Core.Test/ParserTests/NormalizeTitleFixture.cs index 6e2b01366..d846eeee4 100644 --- a/src/NzbDrone.Core.Test/ParserTests/NormalizeTitleFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/NormalizeTitleFixture.cs @@ -72,6 +72,40 @@ public void should_remove_a_from_middle_of_title() } } + [Test] + public void should_not_remove_a_when_at_start_of_acronym() + { + var dirtyFormat = new[] + { + "word.{0}.N.K.L.E.word", + "word {0} N K L E word", + "word-{0}-N-K-L-E-word", + }; + + foreach (var s in dirtyFormat) + { + var dirty = string.Format(s, "a"); + dirty.CleanSeriesTitle().Should().Be("wordankleword"); + } + } + + [Test] + public void should_not_remove_a_when_at_end_of_acronym() + { + var dirtyFormat = new[] + { + "word.N.K.L.E.{0}.word", + "word N K L E {0} word", + "word-N-K-L-E-{0}-word", + }; + + foreach (var s in dirtyFormat) + { + var dirty = string.Format(s, "a"); + dirty.CleanSeriesTitle().Should().Be("wordnkleaword"); + } + } + [TestCase("the")] [TestCase("and")] [TestCase("or")] diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index 0688e59dc..0abd6ba3e 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -278,7 +278,7 @@ public static class Parser //Regex to detect whether the title was reversed. private static readonly Regex ReversedTitleRegex = new Regex(@"[-._ ](p027|p0801|\d{2}E\d{2}S)[-._ ]", RegexOptions.Compiled); - private static readonly Regex NormalizeRegex = new Regex(@"((?:\b|_)(?