Created
March 25, 2016 23:58
-
-
Save brydavis/a96ef023b82457a6df98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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