From 1a21dcacfa49188557911884440f775ce466a774 Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Wed, 19 Sep 2012 06:27:38 -0700 Subject: [PATCH] some progress on regular expressions --- README | 1 - src/xx-regexs.go | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/xx-regexs.go diff --git a/README b/README index 0149627..ac22677 100644 --- a/README +++ b/README @@ -44,7 +44,6 @@ gobyexample.com signups * ruby and nodejs killer apps = topics -* regular expressions * time * connection pool * typed json parse/unparse diff --git a/src/xx-regexs.go b/src/xx-regexs.go new file mode 100644 index 0000000..56c0679 --- /dev/null +++ b/src/xx-regexs.go @@ -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