preg_match numbers and comma
php, preg-match
Solution
Corrected syntax:
$regex="/^[0-9,]+$/";
`^` represents start of line
`+` represents one or more of the group characters
`$` represents end of line
Problem
I have some values like 4,3 or 5 for instance. I want to allow only the numbers (from 0 to 9) and the comma. I found this function, pregmatch but it's not working correctly. ``` <?php $regex="/[0-9,]/"; if(!preg_match($regex, $item['qty'])){ // my work } ?> ``` What's wrong ? Thanks