in reply to Re: Pattern matching when there are exception strings
in thread Pattern matching when there are exception strings

Note that this solution, the other one you provided, and my suggestion to use s///g on exceptions all have the flaw that they won't work if good strings can overlap bad ones. (I.e. if _ALPHA is an exception, but _ALPHALPHA should be a good match.)

-sauoq
"My two cents aren't worth a dime.";
  • Comment on Re^2: Pattern matching when there are exception strings

Replies are listed 'Best First'.
Re^3: Pattern matching when there are exception strings
by Moron (Curate) on Sep 22, 2005 at 08:18 UTC
    Strictly speaking, it wasn't specified whether an overlapping good and bad match is good or bad. As it happens alphabetical superstrings are always exceptions, when there is no whitespace breaking them up and I need to add this in - it also illustrates why it's nasty for a regexp:

    #more exceptions to all /MATCH/ strings: /\w+MATCH\W+/ or /\W+MATCH\w+/ or /\w+MATCH\w+/ ...

    Er, except that of course it doesn't like \W so anyway I'll have to borrow from some other solutions here which use the local negation operator.

    thanks for your input,

    the Moron

    Free your mind