Added more regex cases for naming patterns reported to be common with comics. Some cases added without regex.

This commit is contained in:
Joseph Milazzo 2021-10-04 18:47:57 -05:00
parent f5594eade4
commit d07372b911
2 changed files with 16 additions and 0 deletions

View file

@ -49,6 +49,7 @@ namespace API.Tests.Parser
[InlineData("Chew Script Book (2011) (digital-Empire) SP04", "Chew Script Book")]
[InlineData("Batman - Detective Comics - Rebirth Deluxe Edition Book 02 (2018) (digital) (Son of Ultron-Empire)", "Batman - Detective Comics - Rebirth Deluxe Edition Book")]
[InlineData("Cyberpunk 2077 - Your Voice 01", "Cyberpunk 2077")]
[InlineData("Cyberpunk 2077 #01", "Cyberpunk 2077")]
[InlineData("Batgirl Vol.2000 #57 (December, 2004)", "Batgirl")]
[InlineData("Batgirl V2000 #57", "Batgirl")]
public void ParseComicSeriesTest(string filename, string expected)

View file

@ -312,6 +312,11 @@ namespace API.Parser
@"^(?<Series>.+?)(\s|_|-)?(?:Ep\.?)(\s|_|-)+\d+",
MatchOptions,
RegexTimeout),
// Batgirl Vol.2000 #57 (December, 2004)
new Regex(
@"^(?<Series>.+?)Vol\.?\s?#?(?:\d+)",
MatchOptions,
RegexTimeout),
// Batman & Catwoman - Trail of the Gun 01, Batman & Grendel (1996) 01 - Devil's Bones, Teen Titans v1 001 (1966-02) (digital) (OkC.O.M.P.U.T.O.-Novus)
new Regex(
@"^(?<Series>.+?)(?: \d+)",
@ -351,6 +356,11 @@ namespace API.Parser
@"^(?<Series>.*)(?: |_)v(?<Volume>\d+)",
MatchOptions,
RegexTimeout),
// Batgirl Vol.2000 #57 (December, 2004)
new Regex(
@"^(?<Series>.+?)(?:\s|_)vol\.?\s?(?<Volume>\d+)",
MatchOptions,
RegexTimeout),
};
private static readonly Regex[] ComicChapterRegex = new[]
@ -380,6 +390,11 @@ namespace API.Parser
@"^(?<Series>.+?)(?: |_)(c? ?)(?<Chapter>(\d+(\.\d)?)-?(\d+(\.\d)?)?)(c? ?)-",
MatchOptions,
RegexTimeout),
// Batgirl Vol.2000 #57 (December, 2004)
new Regex(
@"^(?<Series>.+?)(?:vol\.?\d+)\s#(?<Chapter>\d+)",
MatchOptions,
RegexTimeout),
// Batman & Catwoman - Trail of the Gun 01, Batman & Grendel (1996) 01 - Devil's Bones, Teen Titans v1 001 (1966-02) (digital) (OkC.O.M.P.U.T.O.-Novus)
new Regex(
@"^(?<Series>.+?)(?: (?<Chapter>\d+))",