Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^([A-Z]{1,2})\s([A-Z]{1,3})\s([0-9]{4}(?<!0{4}))
/
gm

Description

// Sri Lankan Modern Licence Number Plate Regex //

FORMAT : PP LLL DDDD

PP - Province (SP, NW, WP, UP, CP, NC, SG, EP, NP) LLL - 3 Letter DDDD - 4 Digits

Regex : ^([A-Z]{1,2})\s([A-Z]{1,3})\s([0-9]{4}(?<!0{4}))

MATCHING SAMPLES:

  • SP ABC 3429
  • NW AWD 3421

By Hashan Shalitha

Submitted by anonymous - 4 years ago