Hello Tamás,
would you provide an sample impl in playground,  e.g.   combining patterns 
"ab", "ac", "bc" into "(ab)|(ac)|(bc)"  and then matching input string 
"zabc" ?
We're expecting something like [true, false, true], or ["ab", "bc"], or 
equivalent.

I tried but got stuck because  :
- returned indexes denote positions in the matched string, not in the 
regexp,
- Submatch methods (without All) consider only the leftmost match,
- AllSubmatch method consider only non-overlapping matches, which defeats 
the purpose of matching the same input fragment 10000 times.

Using concatenation to build an uber-regexp (10000x longer) makes perfect 
sense, I think.  On the other hand, I don't contemplate concatenating 10000 
times the input string (wouldn't be more efficient than the naive loop 
approach). Also, we won't try to concatenate 800 millions of something into 
1 single string.

On Thursday, July 28, 2016 at 2:35:13 PM UTC+2, Tamás Gulácsi wrote:
>
> Use Submatch, concatenate the () groups, count inner opening parenthesis 
> to map Submatch index to matching subexpression.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to