i have this regular expression in php:
if (!preg_match('/^([1-9]|1[012])(,([1-9]|1[012]))*$/', $value))
and i want this condition to not run when the $value is just an empty string '' but it runs on empty string please help
i have this regular expression in php:
if (!preg_match('/^([1-9]|1[012])(,([1-9]|1[012]))*$/', $value))
and i want this condition to not run when the $value is just an empty string '' but it runs on empty string please help
Check for the empty string separately.
if ($value != '' && !preg_match('/^([1-9]|1[012])(,([1-9]|1[012]))*$/', $value))