From 53fe7ee98361af783205357dc6cbb65ba7917e2f Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 31 Jul 2023 22:47:14 +0200 Subject: [PATCH] Possible fix for #31 chapter regex --- Tranga/Connectors/Connector.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tranga/Connectors/Connector.cs b/Tranga/Connectors/Connector.cs index 391eaa9..997aeec 100644 --- a/Tranga/Connectors/Connector.cs +++ b/Tranga/Connectors/Connector.cs @@ -77,8 +77,8 @@ public abstract class Connector public Chapter[] SelectChapters(Publication publication, string searchTerm, string? language = null) { Chapter[] availableChapters = this.GetChapters(publication, language??"en"); - Regex volumeRegex = new ("((v(ol)*(olume)*)+ *([0-9]+(-[0-9]+)?){1})", RegexOptions.IgnoreCase); - Regex chapterRegex = new ("((c(h)*(hapter)*)+ *([0-9]+(-[0-9]+)?){1})", RegexOptions.IgnoreCase); + Regex volumeRegex = new ("((v(ol)*(olume)*){1} *([0-9]+(-[0-9]+)?){1})", RegexOptions.IgnoreCase); + Regex chapterRegex = new ("((c(h)*(hapter)*){1} *([0-9]+(-[0-9]+)?){1})", RegexOptions.IgnoreCase); Regex singleResultRegex = new("([0-9]+)", RegexOptions.IgnoreCase); Regex rangeResultRegex = new("([0-9]+(-[0-9]+))", RegexOptions.IgnoreCase); Regex allRegex = new("a(ll)?", RegexOptions.IgnoreCase); @@ -114,7 +114,7 @@ public abstract class Connector } else if (chapterRegex.IsMatch(searchTerm)) { - string chapter = volumeRegex.Match(searchTerm).Value; + string chapter = chapterRegex.Match(searchTerm).Value; if (rangeResultRegex.IsMatch(chapter)) { string range = rangeResultRegex.Match(chapter).Value;