Hey everyone.
I’m trying to validate comma separated numbers as in the case of asking a WordPress admin to enter category or page IDs in a text input field.
The value entered may or may not include multiple numeric IDs so I need to validate both cases so:
a) 12 b) 123,456,789 someone may enter the comma separated IDs also like so: c) 123, 456, 789
I thought this would work:
preg_match('/^\d(?:[,]\d)*(?:[,]\s\d)*$/', $input[$option['id']]);
then use the result in a conditional that will pass the value if there is a match to my $valid_input array
but it fails miserably
I think my regular expession is wrong.
Could anyone help? Please?

