Title |
Test
Find
Dutch Phonenumber
|
Expression |
^((((0031)|(\+31))(\-)?6(\-)?[0-9]{8})|(06(\-)?[0-9]{8})|(((0031)|(\+31))(\-)?[1-9]{1}(([0-9](\-)?[0-9]{7})|([0-9]{2}(\-)?[0-9]{6})))|([0]{1}[1-9]{1}(([0-9](\-)?[0-9]{7})|([0-9]{2}(\-)?[0-9]{6}))))$ |
Description |
Check Dutch phonenumber including 0031 or +31 and optional - characters.
I know it can be shortened, but for readability (and shortage of time ;-)) I kept it like it is... |
Matches |
0031612345678 | 0031-6123456789 | 0031-6-123456789 | 0031-50-1234567 | 0031-592-123456 | +31612345678 | 0612345678 | 06-12345678 | 050-1234567 | 0592-123456 |
Non-Matches |
+31(0)612345678 | 06123456789 | 00310612345678 | 0031-6-123-45678 |
Author |
Rating:
Dennis Betten
|
Source |
Henk Schrier |
Your Rating |
|
Title: Prima RegEx, scheelt me weer wat werk!
Name: JP
Date: 5/24/2014 12:15:44 PM
Comment:
En als je het wilt gebruiken in jQuery validator dan zet je dit bovenaan in de code (nadat je jQuery validator geladen hebt):
jQuery.validator.addMethod("NLtelefoon", function(value, element, params) {
return this.optional(element) || /^((((0031)|(\+31))(\-)?6(\-)?[0-9]{8})|(06(\-)?[0-9]{8})|(((0031)|(\+31))(\-)?[1-9]{1}(([0-9](\-)?[0-9]{7})|([0-9]{2}(\-)?[0-9]{6})))|([0]{1}[1-9]{1}(([0-9](\-)?[0-9]{7})|([0-9]{2}(\-)?[0-9]{6}))))$/i.test(value);
}, "Vul alstublieft een geldig telefoonnummer in.");
jQuery.validator.classRuleSettings.NLtelefoon = { NLtelefoon: true };
Daarnaast het input-element de class 'NLtelefoon' meegeven. Klaar is kees.
Title: The term 'Dutch' is wrong!
Name: Oscar
Date: 8/31/2011 12:26:14 AM
Comment:
The term 'Dutch' is wrong! This is a telephone format from The Netherlands, not 'Dutch'!
'Dutch' is NOT a country but a language which is spoken in different countries (with different forms of telephone numbers).
As such, please do not use such a regexp if you know your users speak 'Dutch'. Their phonenumber pattern might be quite different!
Title: Some off the described mathces are wrong
Name: Maarten
Date: 2/3/2011 7:50:10 AM
Comment:
0031-6-123456789 has a digit to many should be 0031-6-12345678