'Golang Regular Expression: Getting index position of variable
I have a regular expression that has variables (?P<next_tok>) how can I grab the index of that variable match?
Here is the complete regexp:
\S*[\.\?!](?P<after_tok>(?:[?!)";}\]\*:@\'\({\[])|\s+(?P<next_tok>\S+))
Example: http://play.golang.org/p/7CYfK50W2Q
I want to get the matches AND the index of any variable in the regexp match. Is this possible in golang?
EDIT:
I couldn't figure out how to get next_tok by name, but I was able to get all the submatches via FindAllStringSubmatchIndex
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
