Skip to content

Instantly share code, notes, and snippets.

View glcheetham's full-sized avatar

glcheetham glcheetham

View GitHub Profile
@glcheetham
glcheetham / javascript-uk-number-plate-validation.md
Last active March 6, 2024 12:59 — forked from danielrbradley/uk-number-plate-validation.md
Javascript Regular Expression to Validate UK Number Plates

Javascript Regular Expression to Validate UK Number Plates

Regular Expression

Works in jQuery, React, Angular, Javascript es6 and es5

(^[A-Z]{2}[0-9]{2}\s?[A-Z]{3}$)|(^[A-Z][0-9]{1,3}[A-Z]{3}$)|(^[A-Z]{3}[0-9]{1,3}[A-Z]$)|(^[0-9]{1,4}[A-Z]{1,2}$)|(^[0-9]{1,3}[A-Z]{1,3}$)|(^[A-Z]{1,2}[0-9]{1,4}$)|(^[A-Z]{1,3}[0-9]{1,3}$)

Source information

Forked from here but updated to work in JavaScript, and added an optional space