This is my string:
$string = 'BEST 25.65, MEDIUM 4.75, WORST 20.5, BEST 4, MEDIUM 8.9, WORST 160.31, BEST 15.65, MEDIUM 5.33, WORST 160.31, FINISHED';
We have the words "BEST" "MEDIUM" AND "WORST" followed by a dollar amount and a comma. I'm trying to get those dollar amounts (when they exist) into an array.
This does not work:
preg_match_all("/BEST.?(\d{0,3}.\d{1,2}).?,.?MEDIUM.?(\d{0,3}.\d{1,2}).?,.?WORST.?(\d{0,3}.\d{1,2}).?,/",$string,$matches);
I have been wrestling with this logic puzzle for days now... any idea what I'm doing wrong?
Thank you!!