Skip to content

Instantly share code, notes, and snippets.

@matiasinsaurralde
Created January 24, 2017 09:24
Show Gist options
  • Save matiasinsaurralde/8f4029c845011cc3f2a125f594201d7d to your computer and use it in GitHub Desktop.
Save matiasinsaurralde/8f4029c845011cc3f2a125f594201d7d to your computer and use it in GitHub Desktop.
regexp thing
package main
import(
"fmt"
"regexp"
)
func main() {
var (
regexUrl = "(.*)"
inputUrlPath = "/abc"
)
asRegex, regexpErr := regexp.Compile(regexUrl)
if regexpErr != nil {
fmt.Println("Regex error")
}
match := asRegex.MatchString(inputUrlPath)
if match {
fmt.Println("Matches!")
} else {
fmt.Println("Doesn't match :(")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment