right, what was i thinking?
thank you.
On 10/13/06, John W. Krahn <[EMAIL PROTECTED]> wrote:
I.B. wrote:
> sorry, I didn't fraze my question correctly.
^
phrase
> example :
> $line="abcxabcxxabcxxxabc";
>
> how to match everything beofre "xxx" but not xx
I.B. wrote:
> sorry, I didn't fraze my question correctly.
^
phrase
> 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 =
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 "f
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 !~
use !~ vs =~ which is if not so
if ( $line !~ /\(xxx\)/ ) {
# does not contain (xxx)
}else {
# does contain
}
If you have any problems or questions, please let me know.
Thanks.
Wags ;)
David R Wagner
Senior Program