in reply to perlre inverse check for several patterns

The easy way would be to set up a hash of "good" words, then scan for each substring to check against the hash:

my %good = map +($_ => 1), qw{ pre strong }; my $string = "xxx<pre>xxx<www>xxx<strong>xxx"; while ($string =~ m{<(\w+)>}g) { warn "bad word '$1'" unless $good{$1}; }

If you don't care about how invalid strings are invalid, then it is easily done in a single match something like:

print "ok\n" if $string =~ m{ ^ ( [^<] | < (?: pre | strong ) > )* $ }x;

(Note that this will also reject a string with an unclosed '<', which the first example will not.)

If neither of those is what you want, it would be useful if you could say more about precisely what you want to achieve.