I have a regular expression which compares if a string is having both alpha and numerical values. But i need to compare if the string is having any special characters and length of the string should be 6. my current regular expression is
$val = 'A457718';
preg_match('/^[A-Z]|[0-9A-Z]*([0-9][A-Z]|[A-Z][0-9])[0-9A-Z]*$/i', $val)
But i need to compare if there are any special characters are there and string length should be 6. Any help would be greatly appreciated.