Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. r, _ := regexp.Compile("m([a-z]+)ch")
  2. fmt.Println(r.FindStringIndex("much match"))
  3. // [0 4]
  4.  
  5. fmt.Println(r.FindStringSubmatchIndex("much match"))
  6. // [0 4 1 2]
  7.  
  8. fmt.Println(r.FindAllStringSubmatchIndex("much match", -1))
  9. // [[0 4 1 2] [5 10 6 8]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement