Validate UK Driving Licence number using REGEX (DVLA)

My weapon of choice is PHP but I’ve included the raw REGEX too to help others.  I found the information about the makeup of the code on the APH website to help me understand the parts of the code and then REGEXR to help test my REGEX codes.

Driving Licence Number : [A-Z9<]{5}[0-9<]{6}[A-Z9]{2}[A-Z0-9]{3}

$regex = ‘^[A-Z9<]{5}[0-9<]{6}[A-Z9]{2}[A-Z0-9]{3}$^’;

$result = preg_match($regex, $value);

returns TRUE or FALSE

I hope this is useful to you!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.