PHP » GoLang |
login |
register |
about
|
preg_matchpreg_matchNormal match: [code] re := regexp.MustCompile("foo.?") fmt.Printf("%q\n", re.FindString("seafood fool")) fmt.Printf("%q\n", re.FindString("meat")) [/code] Submatch: [code] re := regexp.MustCompile("a(x*)b(y|z)c") fmt.Printf("%q\n", re.FindStringSubmatch("-axxxbyc-")) fmt.Printf("%q\n", re.FindStringSubmatch("-abzc-")) [/code] |