* allow 4-digit season number (e.g. 2009, 2010, ...)

This commit is contained in:
Reinhard Pointner 2010-11-26 14:13:40 +00:00
parent 3974551821
commit b81be6a2a0
2 changed files with 3 additions and 2 deletions

View File

@ -20,8 +20,8 @@ public class SeasonEpisodeMatcher {
public SeasonEpisodeMatcher() {
patterns = new SeasonEpisodePattern[3];
// match patterns like S01E01, s01e02, ... [s01]_[e02], s01.e02, s01e02a, ...
patterns[0] = new SeasonEpisodePattern("(?<!\\p{Alnum})[Ss](\\d{1,2})[^\\p{Alnum}]{0,3}[Ee](\\d{1,3})(?!\\p{Digit})");
// match patterns like S01E01, s01e02, ... [s01]_[e02], s01.e02, s01e02a, s2010e01 ...
patterns[0] = new SeasonEpisodePattern("(?<!\\p{Alnum})[Ss](\\d{1,2}|\\d{4})[^\\p{Alnum}]{0,3}[Ee](\\d{1,3})(?!\\p{Digit})");
// match patterns like 1x01, 1.02, ..., 1x01a, 10x01, 10.02, ...
patterns[1] = new SeasonEpisodePattern("(?<!\\p{Alnum})(\\d{1,2})[x.](\\d{2,3})(?!\\p{Digit})");

View File

@ -44,6 +44,7 @@ public class SeasonEpisodeMatcherTest {
@Test
public void pattern_S01E01() {
assertEquals(new SxE(1, 1), matcher.match("S01E01").get(0));
assertEquals(new SxE(2010, 0), matcher.match("S2010E00").get(0));
// test multiple matches
assertEquals(new SxE(1, 2), matcher.match("S01E01 and S01E02 - Multiple MatchCollection").get(1));