From b57224ec110c5d11cda2754e987c906847bd4277 Mon Sep 17 00:00:00 2001 From: Arran Hobson Sayers Date: Fri, 27 Dec 2024 03:47:29 +0000 Subject: [PATCH] Fix regex --- goodreads/utils.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/goodreads/utils.go b/goodreads/utils.go index df64083..f8f7a56 100644 --- a/goodreads/utils.go +++ b/goodreads/utils.go @@ -36,13 +36,13 @@ func sortBookByAuthorSimilarity(books []Book, author string) { var ( spaceRegex = regexp.MustCompile(`\s+`) - alphanumericRegex = regexp.MustCompile(`[^a-zA-Z0-9]`) + alphanumericRegex = regexp.MustCompile(`[^a-zA-Z0-9 ]`) ) -// normaliseString normalises a string (e.g. title or author) by: +// normaliseString normalises a string (e.g. a title or author) by: // - Replacing (normalising) all whitespace with a single space character // - Removing any leading or training whitespace -// - Removing any non alpha numerical characters +// - Removing any non alpha, numerical or space characters // - Converting text to lowercase // - Removing the "the " prefix func normaliseString(s string) string {