Hmm.. admittedly, the OP's post is slightly confusing.. but here is what I came up with:
$str = <<<DATA
3 widgets at $0.50 each = $0.50
2 widgets at $5.00 each = $5.00 ($2.00 if small widget)
11 widgets at $2.00 each = $2.00
1 widget at $12.01 each = $12.01 ($6.00 if widget is missing wheels)
DATA;
preg_match_all('#^(\d+)[^$]+\$(\d+\.\d+).*(\d+\.\d+).*$#m', $str, $matches);
for($i=0; $i < count($matches[0]); $i++){
echo $matches[1][$i] . ',' . $matches[2][$i] . ',' . $matches[3][$i];
if($matches[2][$i] == $matches[3][$i]){
echo ' // added duplicate';
}
echo '<br />';
}
Output:
3,0.50,0.50 // added duplicate
2,5.00,2.00
11,2.00,2.00 // added duplicate
1,12.01,6.00
But to get the results the OP has listed, I only take into account the last set of digits listed for the second set of reported digits / decimals. So yes, there is some backtracking in this solution, but seems to do the job in accordance to what the OP has listed.