i have to check a comma separated value in which i have to allow only numeric character greater than 0 and comma below is format that i required
- -1,2,3,567,76,67,20,10
and below is the error that should not be accept by the regex
- 0,23,344 23,
- 0,2323,85 34
- 344,44,00
- sdfs,34,34,
i have used the regex
this one accept all numeric character and comma but also accept 0
return ( ! preg_match("/^([0-9,])+$/i", $quantity)) ? FALSE : TRUE;
this one accept not accept 0 at any place
return ( ! preg_match("/^([1-9,])+$/i", $quantity)) ? FALSE : TRUE;