FindStringSubmatch returns a slice of strings holding the text of the leftmost match and the matches of all capture groups. Example: re := coregex.MustCompile(`(\w+)@(\w+)\.(\w+)`) match := re.FindStringSubmatch("user@example.com") // match[0] = "user@example.com" // match[1] = "user"
(s string)
| 636 | // // match[0] = "user@example.com" |
| 637 | // // match[1] = "user" |
| 638 | func (r *Regex) FindStringSubmatch(s string) []string { |
| 639 | match := r.engine.FindSubmatch(stringToBytes(s)) |
| 640 | if match == nil { |
| 641 | return nil |
| 642 | } |
| 643 | return match.AllGroupStrings() |
| 644 | } |
| 645 | |
| 646 | // FindSubmatchIndex returns a slice holding the index pairs for the leftmost |
| 647 | // match and the matches of all capture groups. |