<?php $preg = '\d+(\,\d{3})?(\,\d{3})?(?:\.\d{1,2})?'; $arr = [ '$5,710.75', '$5,710,710.75', '$5710.15', '$57', '$57.1', '$57.', '$5,7.1', '$5,710,710,710.75', ]; foreach ($arr as $str) { echo "$str -> "; $res = preg_match($preg,$a); var_dump($res); } //
You have javascript disabled. You will not be able to edit any code.