Inspired by CommonRegex
This is a collection of often used regular expressions. It provides these as simple functions for getting the matched strings corresponding to specific patterns.
go get github.com/mingrammer/commonregex
import (
cregex "github.com/mingrammer/commonregex"
)
func main() {
text := `John, please get that article on www.linkedin.com to me by 5:00PM on Jan 9th 2012. 4:00 would be ideal, actually. If you have any questions, You can reach me at (519)-236-2723x341 or get in touch with my associate at [email protected]`
date_list := cregex.Date(text)
// ['Jan 9th 2012']
time_list := cregex.Time(text)
// ['5:00PM', '4:00']
link_list := cregex.Links(text)
// ['www.linkedin.com', '[email protected]']
phone_list := cregex.PhonesWithExts(text)
// ['(519)-236-2723x341']
email_list := cregex.Emails(text)
// ['[email protected]']
}
- date
- time
- phone
- phones with exts
- link
- ip
- ipv6
- price
- hex color
- credit card
- VISA credit card
- MC credit card
- ISBN 10/13
- btc address
- street address
- zip code
- po box
- SSN
- MD5
- SHA1
- SHA256
- GUID
- MAC address
- IBAN
- Git Repository