in reply to Pattern matching
This is untested tested (see below)...
But as perlre states, "Sometimes it's still easier just to say: if (/bar/ && $` !~ /foo$/) ."
Updated: Switched m!! to m##.
Update: Here's a test. I think I captured the intent behind your question:
use strict; use warnings; my @strings = ( '/lawyers/stuffLDSstuff/~Firms.html', '/lawyers/stuffnotstuff/~Firms.html' ); foreach my $string ( @strings ) { print $string; if( $string =~ m#/lawyers/(?!.*LDS).*~Firms\.html# ) { print " matches.\n"; } else { print " doesn't match.\n"; } }
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pattern matching
by johnnywang (Priest) on Dec 29, 2004 at 07:04 UTC | |
by hv (Prior) on Dec 29, 2004 at 12:43 UTC | |
|
Re^2: Pattern matching
by bedanta (Novice) on Dec 29, 2004 at 06:47 UTC |