gobyexample/080-regexs.go
Mark McGranaghan 354a9d862f reorder
2012-09-21 07:54:20 -07:00

19 lines
347 B
Go

package main
import ("fmt"; "regexp")
func main() {
m1, _ := regexp.MatchString("p[a-z]+ch", "apple")
m2, _ := regexp.MatchString("p[a-z]+ch", "peach")
fmt.Println(m1)
fmt.Println(m2)
r1, _ := regexp.Compile("p[a-z]+ch")
fmt.Println(r1.MatchString("apple"))
fmt.Println(r1.MatchString("peach"))
}
// == todo
// more
// gsub with regexp