I'd like to filter an input string with a list of commas separated numeric ids to understand if it matches the pattern (only digits and commas allowed, i.e. "112,5,16,4578,ecc").
I'm trying to perform a regular expression match using preg_match.
$ids_list = '112,5,16,4578'; if (preg_match('/[0-9,]*/', $ids_list)) echo'OK!'; else echo'KO!';
Well, it doesn't work at all, printing nearly always an OK! output, even if I put in a ";aaaa;bbbb;" string which is totally alien from the given pattern, what's wrong with it?