From f1db8f52bf1025501a5f6dfa18b9edf8d9efee56 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 24 Mar 2011 08:19:21 -0700 Subject: [PATCH] Parser REGEX updated to support 103 naming and breaking out of the REGEX foreach loop when a match is found. Most strict to less strict ordering of REGEX is required. --- NzbDrone.Core/Parser.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NzbDrone.Core/Parser.cs b/NzbDrone.Core/Parser.cs index 20e443fb0..e6ee8fb90 100644 --- a/NzbDrone.Core/Parser.cs +++ b/NzbDrone.Core/Parser.cs @@ -18,7 +18,8 @@ namespace NzbDrone.Core private static readonly Regex[] ReportTitleRegex = new[] { - new Regex(@"(?.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)(?:\-|\.|[a-z])(?<episode>\d+)\W(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled) + new Regex(@"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)(?:\-|\.|[a-z])(?<episode>\d+)\W(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + new Regex(@"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)\W(?<episode>\d+)\W(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled) //Supports 103 naming }; private static readonly Regex NormalizeRegex = new Regex(@"((\s|^)the(\s|$))|((\s|^)and(\s|$))|[^a-z]", RegexOptions.IgnoreCase | RegexOptions.Compiled); @@ -65,6 +66,7 @@ namespace NzbDrone.Core Logger.Trace("Episode Parsed. {0}", parsedEpisode); } + break; //Break out of the for loop, we don't want to process every REGEX for each item otherwise we'll get duplicates } }