in reply to Regex AND

It looks like you're using a bunch of negative look-ahead assertions to make sure your strings don't start with certain patterns. There are ways to combine them, but you'll have something that's a bit hairy and inefficient. I would rethink what you're parsing a bit, perhaps focusing on positive rather than negative matches for the data you want.

I recall there being a Regexp merging module on CPAN, but I've never used it and cannot find it at the moment. It might be helpful for you.

Check the regular expressions manpage here. I also recommend reading the Mastering Regular Expressions book (O'Reilly information is here and author's web site here) for a tutorial about optimizing regular expressions.

Replies are listed 'Best First'.
Re^2: Regex AND
by gaal (Parson) on Dec 02, 2004 at 12:59 UTC
    That'll be Regexp::Optimizer, which "does, ahem, attempts to, optimize regular expressions" — it performs trie optimization which I believe does not work in this particular case.

      The original author may have been thinking of Regexp::Assemble. I can't say if this module will help with this particular problem.

      Regards,
      Rick
        It will not. Regexp::Assemble matches "everything that any of the individual REs match" (emphasis mine). It makes a disjunction of conditions; the OP wanted a conjunction.
        That module would be for "Regex OR". Interesting module though!