sorry, I didn't fraze my question correctly.

example :
$line="abcxabcxxabcxxxabc";

how to match everything beofre "xxx" but not xxx itself?
the answer i got is to use lookaheads:

my $line = "abcxxabcxxxabc";
if ($line =~ m{(.*?(?:(?!xxx).))xxx}){
    print "matched: $1\n";
}
else{
    print "failed\n";
}


very cool,
thanx everyone
~i


On 10/13/06, John W. Krahn <[EMAIL PROTECTED]> wrote:
>
> I.B. wrote:
> > Hi nice people,
>
> Hello,
>
> > how to specify using regular expressions: match everything but string
> (xxx)
> >
> > i would do this :
> >
> > $line =~ /[^(xxx)]+/;
> >
> > but, as it was mentioned before () inside character class is not
> working.
> > what is solution here?
>
> Perhaps you want:
>
> $line !~ /xxx/;
>
>
>
> John
> --
> Perl isn't a toolbox, but a small machine shop where you can
> special-order
> certain sorts of tools at low cost and in short order.       -- Larry
> Wall
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response >
>
>
>

Reply via email to