Skip to content

Commit

Permalink
Fix regex
Browse files Browse the repository at this point in the history
  • Loading branch information
ahobsonsayers committed Dec 27, 2024
1 parent 11577c0 commit b57224e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions goodreads/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b57224e

Please sign in to comment.