in reply to Regex negative word
Update: just acknowledging the fact that (as has been pointed out) this solution doesn't actually work. I won't bother changing the code, but rather leave it there as an example of how _not_ to do it ;)
Prints:#!/usr/bin/perl -wl use strict; while (<DATA>) { chomp; print "$_ matched" if /^[^(?:cat)]/; } __DATA__ cat dog dog cat frog cat dog mouse dog cat cat dog elephant
Cheers,dog cat matched frog cat dog matched mouse dog cat matched
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex negative word
by GrandFather (Saint) on Mar 30, 2006 at 04:13 UTC | |
|
Re^2: Regex negative word
by pKai (Priest) on Mar 30, 2006 at 06:51 UTC | |
|
Re^2: Regex negative word
by zer (Deacon) on Mar 30, 2006 at 03:44 UTC |