in reply to Re: Alternative matches
in thread Alternative matches

Hm...I had the impression it was something to be avoided because the long list of alternatives could slow things down...

Replies are listed 'Best First'.
Re^3: Alternative matches
by gaal (Parson) on Oct 06, 2004 at 09:36 UTC
    There are probably more and less efficient possible orderings of all the elements in your set, and very probably you can transform the regexp into something with shared prefixes and stuff, but to do that correctly you also need to know/make assumptions about the distribution of your input. For general purpose programming and in most cases, just assembling something like what's in your original post is fine.

    Of course, if you do need to match many timesm or if the alternate lists grow huge, you will need to optimize things.

      Thanks, gaal! I get the idea now :)
Re^3: Alternative matches
by borisz (Canon) on Oct 06, 2004 at 09:27 UTC
    Last time I checked, the list was a _lot_ faster than searching every item alone.
    Boris