Title |
Test
Find
Pattern Title
|
Expression |
^([+]39)?((38[{8,9}|0])|(34[{7-9}|0])|(36[6|8|0])|(33[{3-9}|0])|(32[{8,9}]))([\d]{7})$ |
Description |
Validates a Italian mobile phone number with (or without) the International code |
Matches |
+393471234567 | 3381234567 |
Non-Matches |
+39 3401234567 | 347 1234567 | 338-1234567 |
Author |
Rating:
Not yet rated.
Fabrizio Fortini
|
Source |
|
Your Rating |
|
Title: Incorrect syntax.
Name: g1smd
Date: 8/5/2012 3:26:55 AM
Comment:
Having found the initial 3 there's no need to keep on finding it again, so the (3...|3...|3...|3...) pattern simplifies to 3(...|...|...|...) here. The [+] simplifies to \+ here. The [{8,9}|0] is incorrect syntax. Assume [890] was intended, as phone numbers do not include curly braces, commas or the pipe symbol. The [{7-9}|0] is incorrect syntax. Assume [7-90] was intended as phone numbers do not include curly braces or pipe symbols. The [6|8|0] is incorrect syntax. Assume [680] was intended as phone numbers do not contain the pipe character. The [{8,9}] is incorrect syntax. Assume [89] was intended as phone numbers do not include curly braces or commas. The [\d] simplifies to \d here. When there is only one character, there's no need for the character group syntax.
The pattern simplifies to something like this: ^(\+39)?(3(8[890]|4[7-90]|6[680]|3[3-90]|2[89]))\d{7}$
Title: E' sbagliata
Name: GLB
Date: 11/7/2008 3:37:30 AM
Comment:
It's wrong, it works on some phone numbers only by luck. You confused curly brackets with square brackets, and there's an abnormal use of pipes. This one is correct:
^([+]39)?((38[[8-9]0])|(34[[7-9]0])|(36[680])|(33[[3-9]0])|(32[8-9]))([\d]{7})$
Check the syntax here:
http://www.regextester.com/jssyntax.html
Best regards.
Title: GREAT!!!
Name: FooL
Date: 2/17/2004 11:25:44 AM
Comment:
Thanks Fabrizio, this regexp changed my life!!!
I'll never forget the moment I found it by searchin' "mobile phone" on then search engine.....
THANKS!