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 1
Title Test Details http & www / subdomain check
Expression
^(http\://){1}(((www\.){1}([a-zA-Z0-9\-]*\.){1,}){1}|([a-zA-Z0-9\-]*\.){1,10}){1}([a-zA-Z]{2,6}\.){1}([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*
Description
This checks to see if a URL has http:// in it, and if it has either www or a subdomain before the domain and tld. Without (http\://) it only does the latter check. Replace http by (http|https|ftp) for other protocols. Still not happy about this: http://www.www.passshouldfail.com
Matches
http://www.pass.com http://sub.pass.com http://www.sub.pass.com http://sub.sub.pass.com http://www.sub.sub.pass.com
Non-Matches
fail.com | www.fail.com | www.www.fail.com | http://fail.com | http://http://fail.com | http://http://www.fail.com | sub.fail.com | www.sub.fail.com | sub.sub.fail.com | www.sub.sub.fail.com
Author Rating: Not yet rated. Ewel
   Displaying page 1 of 1 pages; Items 1 to 1

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