I'm using preg_match
to find two letters and 4-6 digits, but there should be a hyphen -
character in the middle. I'm starting from there:
if (preg_match("/^[a-zA-Z]{2}\W[0-9]{4,6}$/"...
I came out with this solution, where I use \W
as an any "non-word" character.
But I know it will be a hyphen, so I would like to be more specific.
if (preg_match("/^[a-zA-Z]{2}.-.[0-9]{4,6}$/"...