Octavian Rasnita wrote:
>
> I wanted to test something like:
>
> Match only if the string contains somewhere a "ab" in it but it doesn't
> contain "ab" between < and >.
>
> For example:
>
> "zzz <> ttt> ab" - matches
> "z ab xx" - matches
> "zzz ab <>ab> tt" - doesn't match
> "ab " - doesn'
So building something like this in 1 regex:
"zzz <> ttt> ab" - matches
"z ab xx" - matches
"zzz ab <>ab> tt" - doesn't match
"ab " - doesn't match
That took me a while to work out but it can be done:
#!/usr/local/bin/perl
use strict;
use warnings;
my @data;
$data[0] = "zzz <> ttt> ab";
$data[1
From: "Rob Coops" <[EMAIL PROTECTED]>
> You could simply say this:
> if ( ! m/ab/ ) {
> #make the world go round
> }
> Or assuming you are looping thru a list you could say something like:
> foreach my $item ( @list ) {
> next if ( $item =~ m/ab/ );
> #make the world go round
> }
I also had this p
You could simply say this:
if ( ! m/ab/ ) {
#make the world go round
}
Or assuming you are looping thru a list you could say something like:
foreach my $item ( @list ) {
next if ( $item =~ m/ab/ );
#make the world go round
}
I personaly like the second one better because of the readability but
zhihuali schreef:
> I was wondering if there's a way to specify "not including this
> phrase" in perl regexp.
> Like such two strings:
> axbcabcd
> axbcacbd
>
> If I say "not including the letter a or the letter b" (=~/[^a^b]/)
> then neither of them will be matched.
The [^a^b] doesn't mean what
zhihuali wrote:
>
> I was wondering if there's a way to specify "not including this phrase" in
> perl regexp.
> Like such two strings:
> axbcabcd
> axbcacbd
>
> If I say "not including the letter a or the letter b" (=~/[^a^b]/) then
> neither of them will be matched. However now I want to say
Hi netters,
I was wondering if there's a way to specify "not including this phrase" in perl
regexp.
Like such two strings:
axbcabcd
axbcacbd
If I say "not including the letter a or the letter b" (=~/[^a^b]/) then neither
of them will be matched.
However now I want to say "not including the ph