Skip to content

Commit

Permalink
Update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hyorigo committed Oct 20, 2023
1 parent da6a5a0 commit 21b66ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,16 @@ func GetColorNames() []string {
return cls
}

// ParseTitle parses the title or topic or idea from the query string.
// ParseTitle parses the labeled title or topic or idea string from the query string. It returns the title or an error if no title is found.
func ParseTitle(query string) (string, error) {
// init regex
regexOnce.Do(initRegex)

// match
q := strings.TrimSpace(query)
m := titleRegexPat.FindStringSubmatch(q)
if len(m) <= 2 { // We now need match of length > 2 as our pattern has a second capture group
if len(m) <= 2 {
// We now need match of length > 2 as our pattern has a second capture group
return emptyStr, errNoTitleMatch
}

Expand Down

0 comments on commit 21b66ab

Please sign in to comment.