Re: [go-nuts] Speeding up multiple regexp matches

2016-07-28 Thread Tamás Gulácsi
You're right: the non-overlapping feature disables this approach. Then only a possible thought remains: group the regexps by their starts, like a true, and match different branches by concatenation, but differentiate with loops. I don't know whether this is feasible or sane at all, sorry. -- Yo

Re: [go-nuts] Speeding up multiple regexp matches

2016-07-28 Thread Val
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

Re: [go-nuts] Speeding up multiple regexp matches

2016-07-28 Thread Tamás Gulácsi
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 e

Re: [go-nuts] Speeding up multiple regexp matches

2016-07-28 Thread Raj
But that won't give me list of all matched regexps. No? On Thursday, July 28, 2016 at 12:32:41 AM UTC-7, Tamás Gulácsi wrote: > > Just concatenate them with |. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and st

Re: [go-nuts] Speeding up multiple regexp matches

2016-07-28 Thread Tamás Gulácsi
Just concatenate them with |. -- 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.goo

Re: [go-nuts] Speeding up multiple regexp matches

2016-07-27 Thread Raj
Thank you for excellent suggestions. I will explore and try them. I am wondering is it possible to single NFA/DFA from set of regular expressions (similar to aho-corasick which does for fixed strings) which can determine matched regexps with single pass on the input. Especially if regular expr

Re: [go-nuts] Speeding up multiple regexp matches

2016-07-27 Thread Caleb Spare
On Wed, Jul 27, 2016 at 9:42 AM, Andy Balholm wrote: > in github.com/andybalholm/redwood, one thing I do is to check each URL > against a (potentially very large) set of regular expressions. Since these > regular expressions generally contain fairly significant amounts of literal > text, I analyz

Re: [go-nuts] Speeding up multiple regexp matches

2016-07-27 Thread Andy Balholm
in github.com/andybalholm/redwood , one thing I do is to check each URL against a (potentially very large) set of regular expressions. Since these regular expressions generally contain fairly significant amounts of literal text, I analyze each regular expre

[go-nuts] Speeding up multiple regexp matches

2016-07-27 Thread Raj
Not specific to golang. Incidentally I am using go to develop this particular tool. I have a piece of text that I want to test against a large number of regular expressions, where a different action is taken based on which regexps successfully matched. The naive approach is to loop through each