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 U,S. Phone Number Parser for .NET (with named groups)
Expression
(\+1|1)?[ \-\.]?\(?(?<areacode>[0-9]{3})\)?[ \-\.]?(?<prefix>[0-9]{3})[ \-\.]?(?<number>[0-9]{4})[ \.]*(ext|x)?[ \.]*(?<extension>[0-9]{0,5})
Description
This regular expression parses virtually any variety of U.S. phone numbers--with or without an extension. If you want a version without the named groups, you can use: (\+1|1)?[ \-\.]?\(?[0-9]{3}\)?[ \-\.]?[0-9]{3}[ \-\.]?[0-9]{4}[ \.]*(ext|x)?[ \.]*[0-9]{0,5}
Matches
601-555-1212|601 5551212|+1.6015551212|601 555 1212|601.555.1212x232|601.555.1212ext232|1 601.555.1212ext232|+1 601.555.1212ext232|+1.(601)5551212|(601) 555 1212|601.555.1212x232|601.555.1212 x233|601.555.1212 x 234|601.555.1212 ext 234|601.555.1212 ext. 234
Non-Matches
601+555+1212
Author Rating: Not yet rated. Anthony Gatlin
Title Test Details Regular Expression to Extract Standard Domain Name
Expression
(http[s]?://)?([A-Za-z0-9-]\.)*(?<domainName>([A-Za-z0-9-]+\.)[A-Za-z]{2,3})/?.$
Description
This regular expression is designed just to extract the domain name from a URL. A domain name may neither start with nor end with a dash. I didn't take the time to add in this check and am actually not sure that it could be easily done. Try it for yourself to understand why.
Matches
http://happycatfish.com/|http://happycatfish.com/our-work
Non-Matches
http://happycatfish.comm|http://happycatfish.c
Author Rating: The rating for this expression. Anthony Gatlin
   Displaying page 1 of 1 pages; Items 1 to 2

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