Regular Expressions 101

Community Library Entry

2

Regular Expression
ECMAScript (JavaScript)

/
^(0((?:[\s\-./]?\d{2,3})+)|([+][1-9]\d{0,3})((?:[\s\-./]?\d{2,3})+))$
/
gm

Description

Phone numbers in Belgium.

  • The pattern does match with delimiters such as [\s./-]
  • No global length is checked
  • Accepts number starting by 0 for local dialing
  • Accepts number starting by +<national code> (+32 in these tests)
Submitted by anonymous - a year ago