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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$
Description
Verifies URLs. Checks for the leading protocol, a good looking domain (two or three letter TLD; no invalid characters in domain) and a somwhat reasonable file path.
Matches
http://psychopop.org | http://www.edsroom.com/newUser.asp | http://unpleasant.jarrin.net/markov/inde
Non-Matches
ftp://psychopop.org | http://www.edsroom/ | http://un/pleasant.jarrin.net/markov/index.asp
Author Rating: Not yet rated. Klaxon Mindjammer
Source
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: Fails on .info tld
Name: Nigel Gossage
Date: 5/19/2011 11:07:05 AM
Comment:
e.g. datm.info


Title: Very good
Name: Jefffan24
Date: 1/7/2011 8:25:44 AM
Comment:
This worked perfect for what I needed.


Title: Allows double period
Name: Kymagic
Date: 11/23/2010 10:40:30 AM
Comment:
This pattern allows double periods in URLs. For example, http://www..example.com is matched.


Title: pattern regular
Name: NguyenMinhTan
Date: 3/20/2010 5:55:51 AM
Comment:
hi, i want to display all url in a file ( http://....). i can't use regular expression how to match it. may you help me.


Title: Missing backslash in javascript
Name: Stephen Lorimor
Date: 8/17/2008 3:20:57 PM
Comment:
Firefox 3.0 threw up a warning about this expression that it had unterminated parentheses. As near as I can determine, the final forward slash should be escaped. So it should look like this: ^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?$


Title: simple help
Name: jacob
Date: 10/10/2006 11:50:26 PM
Comment:
could you tell me how to use this pattern in Javascript? and could you give me a exmaple? zhangzhao@live.cn


Title: with php
Name: Jorgen Skogmo
Date: 4/19/2004 2:29:03 AM
Comment:
Thanks! To use it with php, I had to add a "^" at the very end, to stop php complaining about a "missing end delimiter": preg_match( "^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$^", $value ) sweet :)


Title: Doesn't catch subdirectories
Name: Chris
Date: 10/21/2003 7:01:11 PM
Comment:
Testing for the following fails: http://www.example.com/path/to/file.html


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