bcromwell has asked for the wisdom of the Perl Monks concerning the following question:

I have been studying perl regular expressions but I am having an Issue with one example, I am trying to take a text string and pull out the two numeric values and add them to num1 and num2
Here is what I came up with but it says it is missing a ) but I can find what I have missed or messed up.

$foo = "What is 1234345345 x 234234234234? ";
($num1, $num2) = ($foo =~ /\D+(\d+)\D+\(\d+)/ );
Thanks
Bryan

Replies are listed 'Best First'.
Re: Newbie Perl RegEx Question/Problem
by xorl (Deacon) on Apr 08, 2005 at 19:21 UTC
    Take out the escape char on the ( before the last small d.\ Like this:
    $foo = "What is 1234345345 x 234234234234? "; ($num1, $num2) = ($foo =~ /\D+(\d+)\D+(\d+)/ );
      Oh!! Thank You so very much!!