请问一个正则匹配的问题

请问一个正则匹配的问题

我想匹配网页中的价格

网页源代码是 setImageYourPriceText('<span class="price">$679.00</span>');

我想把$679给匹配出来

但是有的网页源代码是setImageYourPriceText('<span class="price">$1,679.00</span>');

有没有办法把他们区分开来,分别匹配出价格$679和$1679?

谢谢


[Copy to clipboard] [ - ]
CODE:
my $str1 = 'setImageYourPriceText(\'<span class="price">$679.00</span>\');';
my $str2 = 'setImageYourPriceText(\'<span class="price">$1,679.00</span>\');';

$str1 =~ />(\$\d+)\./;
print $1, "\n";
$str2 =~ />(\$\d+,\d+)\./;
print $1, "\n";