If the regexps aren't dynamic then Ragel 
(http://www.colm.net/open-source/ragel/).
There's https://github.com/BurntSushi/rure-go, which might work better than 
Go-s regexp.

There might be interesting approaches depending on the regexp and input 
data.

Also, show example data and some regexps that are representative of the 
data you are running it on.

+ Egon

On Wednesday, 27 July 2016 11:11:35 UTC+3, Raj wrote:
>
> 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 regexp and if matches 
> do the corresponding action and continue.
>
> I thought of combining all of the regular expressions into one massive 
> regexp, and let the regexp state machine do all the discriminating. The 
> problem with
> this is that it gives you no way to determine which regexps were the matched 
> among all.
>
> Any suggestions?
>
>
>

-- 
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