Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^[0]{1}[12345689]{1}[0-9]{1}[0-9]{7}$
/
gm

Description

Sri Lankan Land/Fixed-line Telephone Number Validation

This expression validates if a given value is a valid Sri Lankan fixed line / land line telephone number.

Sri Lankan land line numbers starts from 0 and does not contain 7 in the 2nd digit, and is 10 digits in length.

^[0]{1}[12345689]{1}[0-9]{1}[0-9]{7}$

Submitted by Isuru Ranawaka - 2 years ago