some progress on regular expressions

This commit is contained in:
Mark McGranaghan 2012-09-19 06:27:38 -07:00
parent 3c4a25ad34
commit 1a21dcacfa
2 changed files with 16 additions and 1 deletions

1
README
View File

@ -44,7 +44,6 @@ gobyexample.com signups
* ruby and nodejs killer apps
= topics
* regular expressions
* time
* connection pool
* typed json parse/unparse

16
src/xx-regexs.go Normal file
View File

@ -0,0 +1,16 @@
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