in reply to a regex which can detect if a string have all of some characters
#!/usr/bin/perl use strict; use warnings; use Test::More qw(no_plan); my @a = ('a','r','z','x'); my $re = join '', map { "(?=.*?$_)" } @a; like 'xzarfoobar', qr{$re}; unlike 'zarfoobar', qr{$re};
(Update: formulated as test script)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: a regex which can detect if a string have all of some characters
by ikegami (Patriarch) on May 13, 2008 at 21:27 UTC | |
by moritz (Cardinal) on May 13, 2008 at 21:30 UTC |