Skip to content

Instantly share code, notes, and snippets.

@brydavis
Created March 25, 2016 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brydavis/a96ef023b82457a6df98 to your computer and use it in GitHub Desktop.
Save brydavis/a96ef023b82457a6df98 to your computer and use it in GitHub Desktop.
package main
import "regexp"
func CleanQuery(q string) string {
r1 := regexp.MustCompile(`\s+`)
r2 := regexp.MustCompile(`--[^\n]*\n`)
q = r2.ReplaceAllString(q, "")
return r1.ReplaceAllString(q, " ")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment