diff --git a/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs index f74938063..68a7b2735 100644 --- a/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/SingleEpisodeParserFixture.cs @@ -100,6 +100,7 @@ namespace NzbDrone.Core.Test.ParserTests //[TestCase("Sex And The City S6E15 - Catch-38 [RavyDavy].avi", "Sex And The City", 6, 15)] // -38 is getting treated as abs number [TestCase("Castle.2009.S06E03.720p.HDTV.X264-DIMENSION [PublicHD].mkv", "Castle.2009", 6, 3)] [TestCase("19-2.2014.S02E01.720p.HDTV.x264-CROOKS", "19-2 2014", 2, 1)] + [TestCase("Hulk and the Agents of SMASH S02E08 1080p WEB-DL DD5 1 H 264-YFN", "Hulk and the Agents of S.M.A.S.H.", 2, 8)] //[TestCase("", "", 0, 0)] public void should_parse_single_episode(string postTitle, string title, int seasonNumber, int episodeNumber) { diff --git a/src/UI/Mixins/TagInput.js b/src/UI/Mixins/TagInput.js index a03730532..81c3e47c3 100644 --- a/src/UI/Mixins/TagInput.js +++ b/src/UI/Mixins/TagInput.js @@ -14,11 +14,12 @@ define( $.fn.tagsinput.Constructor.prototype.add = function (item, dontPushVal) { var self = this; - var tagLimitations = new RegExp('[^-_a-z0-9]', 'i'); if (typeof item === 'string' && this.options.tag) { - if (item === null || item === '' || tagLimitations.test(item)) { + var test = testTag(item); + + if (item === null || item === '' || !testTag(item)) { return; } @@ -133,10 +134,10 @@ define( var substringMatcher = function() { return function findMatches(q, cb) { // regex used to determine if a string contains the substring `q` - var substrRegex = new RegExp(q, 'i'); + //var substrRegex = new RegExp(q, 'i'); var matches = _.select(TagCollection.toJSON(), function (tag) { - return substrRegex.test(tag.label); + return tag.label.toLowerCase().indexOf(q.toLowerCase()) > -1; }); cb(matches); @@ -148,4 +149,15 @@ define( return _.contains(tagValues, tag.id); }); }; + + var testTag = function(item) { + var tagLimitations = new RegExp('[^-_a-z0-9]', 'i'); + + try { + return !tagLimitations.test(item); + } + catch (e) { + return false; + } + }; });