laziness, impatience, and hubris | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
How can I write code that means match anything that does not contain, for instance, "ah" or "bh"? Would this work: Your question is not as simple as it seems. Strings of characters aren't quite interchangeable with characters. There are several semantics availible that all reduce to the same case for single-character strings. This one may match, as the first character of the match, an "h" from "ah" or "bh":
This one may match, as the last character of the match, an "a" or "b" from "ah" or "bh":
This one may match neither of the above; for instance, only "xx" will be matched in "bhxxah":
This one may match either or both (or, with /g, all) of the above, for instance "b", "hxxa", and/or "h" from "bhxxah":
And that's just for simple two-character strings ...
print "Just another Perl ${\(trickster and hacker)},"
In reply to Re: RegEx: How to negate more than one character?
by Sidhekin
|
|