Skip to content

Instantly share code, notes, and snippets.

@sbose78
Created February 8, 2018 08:33
Show Gist options
  • Save sbose78/9b93f2eeb2ce7c345a160280570ba921 to your computer and use it in GitHub Desktop.
Save sbose78/9b93f2eeb2ce7c345a160280570ba921 to your computer and use it in GitHub Desktop.
func RegisterAsKnownURL(name, urlRegex string) {
compiledRegex := regexp.MustCompile(urlRegex)
groupNames := compiledRegex.SubexpNames()
knownURLLock.Lock()
defer knownURLLock.Unlock()
knownURLs[name] = KnownURL{
URLRegex: urlRegex,
compiledRegex: regexp.MustCompile(urlRegex),
groupNamesInRegex: groupNames,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment