some progress on regular expressions
This commit is contained in:
parent
3c4a25ad34
commit
1a21dcacfa
1
README
1
README
@ -44,7 +44,6 @@ gobyexample.com signups
|
|||||||
* ruby and nodejs killer apps
|
* ruby and nodejs killer apps
|
||||||
|
|
||||||
= topics
|
= topics
|
||||||
* regular expressions
|
|
||||||
* time
|
* time
|
||||||
* connection pool
|
* connection pool
|
||||||
* typed json parse/unparse
|
* typed json parse/unparse
|
||||||
|
16
src/xx-regexs.go
Normal file
16
src/xx-regexs.go
Normal 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
|
Loading…
x
Reference in New Issue
Block a user