Created
January 24, 2017 09:24
-
-
Save matiasinsaurralde/8f4029c845011cc3f2a125f594201d7d to your computer and use it in GitHub Desktop.
regexp thing
This file contains hidden or 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( | |
"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