Skip to content

Instantly share code, notes, and snippets.

@mortymacs
Created August 2, 2014 10:08
Show Gist options
  • Select an option

  • Save mortymacs/8ded52aaf52f8f0183b2 to your computer and use it in GitHub Desktop.

Select an option

Save mortymacs/8ded52aaf52f8f0183b2 to your computer and use it in GitHub Desktop.
This is simple regex in Golang
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])
}
}
@kamcpp
Copy link

kamcpp commented Aug 2, 2014

Great ;) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment