in reply to Re: regular xpression stuff
in thread regular xpression stuff

if (/^([bat])(?!\1)([bat])(?!\2)([bat])(?!\3)/){</i>

This does not entirely work, 'bab', for instance, passes the match.

the following modified version works, but it is not too elegant, just imagine checking a 5 letter word!

if (/^([bat])(?!\1)([bat])(?!\2|\1)([bat])(?!\3|\2|\1)/){

Will perl for money
JJ Knitis
(901) 756-7693
gt8073a@industrialmusic.com

Replies are listed 'Best First'.
Re: Re: Re: regular xpression stuff
by Lucky (Scribe) on Jan 21, 2002 at 22:09 UTC
    For any word:
    my $set='bat'; my $regexp; for (my $i=1;$i<=length($set);$i++){ my $x=join '|', map {"\\$_"} 1..$i; $regexp.="([$set])(?!$x)"; } if (/^$regexp/){ # do something }
    Terrible... :-)