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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 2
Title Test Details International Phone Number Capture
Expression
^011-(?<IntlCountryCode>[1-9][0-9]{1,5})-(?<IntlAreaCode>[0-9]+)-(?<IntlPhoneNumber>[0]?\d[0-9]+)(?:[^\d\-]+(?<IntlExtension>\d{1,4}))?$
Description
International Phone Number separated into its component parts by dashes (International Country Code, International Area Code, International Phone Number, and optional 1-4 digit Extension). (The separator before extension is one or more characters that are not a dash or a number.) This allows explicit parsing/extraction of the extension.
Matches
011-44-020-123456 ext. 1234 | 011-44-020-123456 1234 | 011-44-020-123456 x1234
Non-Matches
44-020-123456 ext. 1234 | 123-456-7890
Author Rating: Not yet rated. Ananda Tracy
Title Test Details Capture International Phone Numbers
Expression
^011-(?<IntlCountryCode>[1-9][0-9]{1,5})-(?<IntlAreaCode>[0-9]+)-(?<IntlPhoneNumber>[0]?\d[0-9]+)(?:[^\d\-]+(?<IntlExtension>\d{1,4}))?$
Description
Requires the International Phone Number to be separated into its component parts by dashes ("011-CC-AC-PH EXT" where "CC" is the 1 to 5 digit country code, "AC" is the area code, "PH" is the phone number, and "EXT" is the optional 1 to 4 digit extension.) (The separator before extension is one or more characters that are not a dash or a number.) This allows explicit parsing/extraction of the extension. Also Captures international phone number components, including an optional extension into named groups.
Matches
011-12345-67-8901234|011-12345-67-8901234 5678
Non-Matches
123-456-7890|123-456-7890 1234
Author Rating: Not yet rated. Ananda Tracy
   Displaying page 1 of 1 pages; Items 1 to 2

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