in reply to Re^4: Negating a regexp
in thread Negating a regexp

which is actually correct (bill is rejected remember). Try somestringtedless instead (ted is not rejected - lucky ted)


DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^6: Negating a regexp
by ikegami (Patriarch) on Jan 31, 2006 at 23:05 UTC

    I didn't say it never works. I know it works for "ted", but it doesn't work for "bil". "bil" doesn't match /bob|fred|bill/ so it should be changed to "HIT".

    [^chars] means "something that isn't 'c', 'h', 'a', 'r' or 's'". What you posted doesn't necessarily mean "something that isn't 'bob', 'fred' or 'bill'". (It depends on what bob, fred, bill and more really are.)

    Update: Added "necessarily".

      Ah yes, I see what you mean. My eye didn't notice that it was billess rather than billless. Tricky!


      DWIM is Perl's answer to Gödel