Regular Expressions 101

Community Patterns

1...34567...241

Sri Lankan National Identity Card and Sri Lanka Identity Number validation

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^([1-9]{1}[0-9]{8}[VvXx])|([1-9]{1}[0-9]{11})$
/
gm

Description

Sri Lankans have two types of identifiation numbers.

  1. National Identity Card number

  2. Sri Lanka Identity Number

  3. National Identity Card number

  • last two digits of the birth year
  • 3 digits for the number of days to birth date
  • number for the registration
  • V or X character
  1. Sri Lanka Identity Number
  • 4 digits of the birth year
  • 3 digits of number of days the to birth date
  • a single digit
  • number for the registration
Submitted by Isuru Ranawaka - 2 years ago