Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my question is there a consise regex which can detect if a string have all of a predetemined characters?my @a = ('a','r','z','x'); my $mystring = 'areqrtyzx'; for( my $i=0; $i<$#a+1; $i++ ) { if($mystring !~ /$a[$i]/) {print "no match";last;} }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: a regex which can detect if a string have all of some characters
by moritz (Cardinal) on May 13, 2008 at 21:21 UTC | |
by ikegami (Patriarch) on May 13, 2008 at 21:27 UTC | |
by moritz (Cardinal) on May 13, 2008 at 21:30 UTC | |
|
Re: a regex which can detect if a string have all of some characters
by GrandFather (Saint) on May 13, 2008 at 22:05 UTC | |
|
Re: a regex which can detect if a string have all of some characters
by pc88mxer (Vicar) on May 13, 2008 at 21:21 UTC | |
|
Re: a regex which can detect if a string have all of some characters
by leocharre (Priest) on May 14, 2008 at 03:29 UTC | |
|
Re: a regex which can detect if a string have all of some characters
by mwah (Hermit) on May 14, 2008 at 06:54 UTC | |
|
Re: a regex which can detect if a string have all of some characters
by rovf (Priest) on May 15, 2008 at 09:39 UTC |