Regular Expressions 101

Community Patterns

UK Student UPN Validation

1

Regular Expression
PCRE (PHP <7.3)

/
^([A-HJ-NP-RT-Z])(\d{11})(\d|[A-HJ-NP-RT-Z])$
/

Description

Performs basic validation of a UK school student UPN.

NOTE: this is not a guarantee that the UPN is valid, as further calculations must be done to verify the control character at the start of the UPN. See the official guidance for more details: https://www.gov.uk/government/publications/unique-pupil-numbers

Submitted by GeekJosh - 8 years ago