In article <[EMAIL PROTECTED]>, Paul D. Kraus wrote:
>> I am having a hard time getting a regular expression to work the way i
> want
>> it to. Take the following text: bla bla bla (la la) bla bla (di da)
>
> my ( $var1, $var2 ) = ( $1, $2 ) if /$inputstring =~ m/bla bla bla (la la)
> bla bla (di da)
>
> $1 gets la la
> $2 gets di da
But his line has parentheses. I think these have to be escaped if you want
to match on them: \( and \) otherwise they become capturing "Klaemmer".
(Right?)
Here is what I came up with (I'm sure someone can do this more elegantly):
if ($line =~ /[^(]*\(([^)]+)\)[^(]*\(([^)]+)\)/) {
print "$1 and $2\n";
}
--
Kevin Pfeiffer
International University Bremen
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]