in reply to Multiline match for empty string
#!/usr/bin/perl use strict; use warnings; my $tests = '% only 1 profile is allowed '; my $regex = '\S'; if($tests !~ qr{$regex}ms) { print "$tests\n REGEX MATCHED\n"; } else { print "$tests\n FAILED!\n"; }
You could also dynamically build your regular expression based upon the string itself:
my $regex = '^\n{' . $tests =~ tr/\n/\n/ . '}';
If neither of these meet spec, I'd appreciate a more thorough description of what you mean by "maintain this multiline match regex format". I sense this is an XY Problem.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Multiline match for empty string
by josh803316 (Beadle) on Aug 05, 2010 at 17:19 UTC | |
by kennethk (Abbot) on Aug 05, 2010 at 18:13 UTC | |
by josh803316 (Beadle) on Aug 05, 2010 at 18:25 UTC |