Regular Expressions 101

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^(\+90|0)?\s*(\(\d{3}\)[\s-]*\d{3}[\s-]*\d{2}[\s-]*\d{2}|\(\d{3}\)[\s-]*\d{3}[\s-]*\d{4}|\(\d{3}\)[\s-]*\d{7}|\d{3}[\s-]*\d{3}[\s-]*\d{4}|\d{3}[\s-]*\d{3}[\s-]*\d{2}[\s-]*\d{2})$
/
gm

Description

Supported Formats +90 or 0 are optional. (ddd)ddd-dd-dd (ddd)ddd-dddd (ddd)ddddddd (ddd) ddd-dd-dd (ddd) ddd-dddd (ddd) ddddddd (ddd)ddd dd dd (ddd)ddd dddd (ddd)ddddddd (ddd) ddd dd dd (ddd) ddd dddd (ddd) ddddddd (ddd)-ddd-dd-dd (ddd)-ddd-dddd (ddd)-ddddddd (ddd) -ddd-dd-dd (ddd) -ddd-dddd (ddd) -ddddddd ddd-ddd-dd-dd ddd-ddd-dddd ddd ddd-dd-dd ddd ddd-dddd ddd-ddd dd dd ddd-ddd dddd ddd ddd dd dd ddd ddd dddd

Submitted by Fatih Bahceci - 2 years ago