Created
January 17, 2017 06:39
-
-
Save jemygraw/8f77b9c392ae2283c7b1b4d5291818b9 to your computer and use it in GitHub Desktop.
golang regexp group
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"regexp" | |
) | |
func main() { | |
rule := `^/upload/photo/(\w+)/(\w+)/(\w+)/(70|60|48|32|16|80|150)\_(.*)$` | |
str := "/upload/photo/0/0/0/70_u57313833790062233714.jpg" | |
r := regexp.MustCompile(rule) | |
m := r.FindAllStringSubmatch(str, -1) | |
fmt.Println(m) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment