I am really empty at Regex side and that\'s why couldn\'t get how to make a Regex in PHP which checks if the string has this particular sequence of characters.
If you do not care about the format then you can just check for the characters:
$regex = '/^[0-9,]+$/';
if (preg_match($regex, $str) === 1) {
echo 'Matches!';
}
You can also do it without using regular expressions:
$str = str_replace(',', '', $str);
if (ctype_digit($str)) {
echo 'Matches!';
}
If you care about the format then something like this would work:
$regex = '/^[0-9]+(?:,[0-9]+)*$/';
if (preg_match($regex, $str) === 1) {
echo 'Matches!';
}