in reply to Re: Regex triggering uninitialised values
in thread Regex triggering uninitialised values

Thanks, jimbojones!

What if I need to match more than one digit before %var%?

  • Comment on Re^2: Regex triggering uninitialised values

Replies are listed 'Best First'.
Re^3: Regex triggering uninitialised values
by Eimi Metamorphoumai (Deacon) on Nov 19, 2004 at 17:58 UTC
    Then you'd have
    $str =~ s/(\d*)%var%(.*)/$1REPLACED$2/;
    Although, unless you're going to use $1 and/or $2 later, there's no reason to have them at all.
    $str =~ s/%var%/REPLACED/;
Re^3: Regex triggering uninitialised values
by ysth (Canon) on Nov 19, 2004 at 17:50 UTC
    (\d*)