Created
August 2, 2014 10:08
-
-
Save mortymacs/8ded52aaf52f8f0183b2 to your computer and use it in GitHub Desktop.
This is simple regex in Golang
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" | |
| import "regexp" | |
| func main() { | |
| re := regexp.MustCompile("[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+\\.[a-z]{2,}") | |
| match := re.FindStringSubmatch("this is my email [email protected]") | |
| if len(match) != 0 { | |
| fmt.Printf("Email: %s\n",match[0]) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great ;) Thanks!