RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find New Zealand Phones
Expression
^(((\+?64\s*[-\.]?[3-9]|\(?0[3-9]\)?)\s*[-\.]?\d{3}\s*[-\.]?\d{4})|((\+?64\s*[-\.\(]?2\d{1}[-\.\)]?|\(?02\d{1}\)?)\s*[-\.]?\d{3}\s*[-\.]?\d{3,5})|((\+?64\s*[-\.]?[-\.\(]?800[-\.\)]?|[-\.\(]?0800[-\.\)]?)\s*[-\.]?\d{3}\s*[-\.]?(\d{2}|\d{5})))$
Description
This phone pattern matches all New Zealand phone numbers with formatting and returns a single formatted string as the first return in the array. Does not take into account all specific exclusions, though, in case of changes (like 025 to 027 in 2007). Based off of CGRdevelopment's New Zealand regex.
Matches
6402123456 | +64.800.12345678 | (03) 123 4567 | 021123456 | 027-123-456 | +64-027-123-123
Non-Matches
02.123.4567 | +64031234567 | 64.024.123.4567 | 800.123456
Author Rating: The rating for this expression. Jeff Wain
Source CGRdevelopment's regex for NZ
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Thank you Jeff
Name: Sam
Date: 3/10/2022 10:03:33 PM
Comment:
Hi Jeff, Thank you for this regex. It works perfectly. made a slight alteration to account for the 210 provider. Expression: ^(((\+?64\s*[-\.\ ]?[3-9]|\(?0[3-9]\)?)\s*[-\.\ ]?\d{3}\s*[-\.\ ]?\d{4})|((\+?64\s*[-\.\(\ ]?2\d{1,2}[-\.\)\ ]?|\(?02\d{1}\)?)\s*[-\.\ ]?\d{3}\s*[-\.\ ]?\d{3,5})|((\+?64\s*[-\.\ ]?[-\.\(\ ]?800[-\.\)\ ]?|[-\.\(\ ]?0800[-\.\)\ ]?)\s*[-\.\ ]?\d{3}\s*[-\.\ ]?(\d{2}|\d{5})))|^$$


Title: Thank you Jeff
Name: Sam
Date: 3/10/2022 10:01:00 PM
Comment:
Hi Jeff, Thank you for this regex. It works perfectly. made a slight alteration to account for the 210 provider. Expression: ^(((\+?64\s*[-\.\ ]?[3-9]|\(?0[3-9]\)?)\s*[-\.\ ]?\d{3}\s*[-\.\ ]?\d{4})|((\+?64\s*[-\.\(\ ]?2\d{1,2}[-\.\)\ ]?|\(?02\d{1}\)?)\s*[-\.\ ]?\d{3}\s*[-\.\ ]?\d{3,5})|((\+?64\s*[-\.\ ]?[-\.\(\ ]?800[-\.\)\ ]?|[-\.\(\ ]?0800[-\.\)\ ]?)\s*[-\.\ ]?\d{3}\s*[-\.\ ]?(\d{2}|\d{5})))|^$$


Title: Thank you Jeff
Name: Sam
Date: 3/10/2022 10:00:37 PM
Comment:
Hi Jeff, Thank you for this regex. It works perfectly. made a slight alteration to account for the 210 provider. Expression: ^(((\+?64\s*[-\.\ ]?[3-9]|\(?0[3-9]\)?)\s*[-\.\ ]?\d{3}\s*[-\.\ ]?\d{4})|((\+?64\s*[-\.\(\ ]?2\d{1,2}[-\.\)\ ]?|\(?02\d{1}\)?)\s*[-\.\ ]?\d{3}\s*[-\.\ ]?\d{3,5})|((\+?64\s*[-\.\ ]?[-\.\(\ ]?800[-\.\)\ ]?|[-\.\(\ ]?0800[-\.\)\ ]?)\s*[-\.\ ]?\d{3}\s*[-\.\ ]?(\d{2}|\d{5})))|^$$


Title: Thank you
Name: chillybin
Date: 12/15/2014 10:50:18 PM
Comment:
First one I have found to work, thanks a lot.


Title: Thank you
Name: chillybin
Date: 12/15/2014 10:50:10 PM
Comment:
First one I have found to work, thanks a lot.


Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials