Community Patterns

Community Library Entry

1

Regular Expression
Created·2015-08-18 18:08
Flavor·PCRE (Legacy)

/
^((00|\+)[0-9]{2,5}|0)[1-9][0-9]{8,9}$
/
gm
Open regex in editor

Description

It accepts phone numbers of the form 0XX XXX XX XX (stylized here, it doesn't really accept spaces). Also, it can detect the international area code (e.g. +41 OR 0041 for Switzerland). It's not a good idea to rely on the groups (because they do not work for this reason. At ALL.

Submitted by Adowrath