Hi dear Rustceans,
I'm reading a file line by line and testing each line for a match against a list of regexes, and if a match is found, interested in the capture groups. Reading is stopped after the first match, to simplify.
I could use either a
RegexSet or a
- is it faster to use a
RegexSetand if match, get capture groups by calling captures() a the regex which triggers the match
- or call captures() on each element of the vector and test if not
I suppose it depends on the number of regexes to test, and also of the probability of a match. If a match is unlikely, maybe it's faster to call
RegexSet::matches() and then if a match is found, get the captures in a second step ?
Do you have an advice on that ?
Thanks for any hint.