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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
(((ht|f)tp(s?):\/\/)|(www\.[^ \[\]\(\)\n\r\t]+)|(([012]?[0-9]{1,2}\.){3}[012]?[0-9]{1,2})\/)([^ \[\]\(\),;"'<>\n\r\t]+)([^\. \[\]\(\),;"'<>\n\r\t])|(([012]?[0-9]{1,2}\.){3}[012]?[0-9]{1,2})
Description
v2 A general purpose expresion to find url's (improved). Add heads to first part, example: ((imap:|(ht|f)tp(s?):\/\/)|(www\. to find url's like imap://www.com/, so ip's. No ipv6 (yet)
Matches
www.domain.com | http://www.blah.ru | https://192.168.0.2:80/users/~fname.lname/file.ext
Non-Matches
imap://.com
Author Rating: The rating for this expression. James Tikitiki
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: Youtube url problem
Name: Yo'Sarin
Date: 4/5/2012 6:54:36 AM
Comment:
It breaks up url like http://www.youtube.com/* into 'http://www.y'


Title: visitor
Name: ktab
Date: 3/11/2012 8:39:23 AM
Comment:
same problem as Alient and as I can see, this is not solved. I want to use this pattern as mask for my textbox and there are some letters that only typed as upper case (e.g. G, L, N, O, Q, R, T, U) Any solution in this?


Title: Good but sometimes fails
Name: Tom
Date: 10/11/2011 12:53:37 PM
Comment:
Fails for some that I tried: http://news.sky.com/skynews/Home/Politics/Eric-Carlin-Quits-Drugs-Panel-Government-Adviser-Resigns-Over-Criminalisation-Of-Mephedrone/Article/201004115591826 http://news.sky.com/skynews/Home/Politics/Eric-Carlin-Quits-Drugs-Panel-Government-Adviser-Resigns-Over-Criminalisation-Of-Mephedrone/Article/201004115591826 but works for others of similar length such as www.thisisleicestershire.co.uk/news/Leicester-East-MP-Keith-Vaz-calls-ban-legal-drug-mephedrone/article-1947876-detail/article.html


Title: Good but sometimes fails
Name: Tom
Date: 10/11/2011 12:53:11 PM
Comment:
Fails for some that I tried: http://news.sky.com/skynews/Home/Politics/Eric-Carlin-Quits-Drugs-Panel-Government-Adviser-Resigns-Over-Criminalisation-Of-Mephedrone/Article/201004115591826 http://news.sky.com/skynews/Home/Politics/Eric-Carlin-Quits-Drugs-Panel-Government-Adviser-Resigns-Over-Criminalisation-Of-Mephedrone/Article/201004115591826 but works for others of similar length such as www.thisisleicestershire.co.uk/news/Leicester-East-MP-Keith-Vaz-calls-ban-legal-drug-mephedrone/article-1947876-detail/article.html


Title: UpperCase problem after www. keyword
Name: Alient
Date: 10/3/2011 5:57:21 AM
Comment:
Hey! Hi! it's really great regex and wanna use it for my URI textbox. But There is a problem about case sensitive situation. whatever keyword I write, after "www." when ı started to write the url address, some letters comes as upper case and some comes lower case... it's kind of mixed letters... how can I fix it?


Title: my pattern
Name: bigtall
Date: 11/9/2008 8:09:19 PM
Comment:
((\w+)\:\/+)?(([\w\-]+(\.[\w\-]+)+)(\:\d+)?)([\w\-\/\.\?;&]+)? this is my pattern


Title: doesnt match http://aol.com
Name: jeff
Date: 6/20/2008 4:35:08 PM
Comment:
nice expression.. maybe just a tweak to get it to match urls like http://aol.com? thanks! :)


Title: Best URL matcher so far
Name: Imbrod
Date: 6/6/2008 6:31:49 PM
Comment:
This is the best URL matcher so far and I've tried dozens and dozens of regexps seeking for URLs Bravo, James! P.S. You can't expect to match blah.ru, cause nobody can guess that is URL. In fact, that is not URL. URL is http(s)://(www.)blah.ru or we can say that URL is URL without the protocol but with the www prefix. Saying that DOMAIN is URL - it just isn't. Look for the domain matches, there are plenty examples on this site.


Title: Not so flexible
Name: Mori
Date: 3/10/2005 2:20:50 PM
Comment:
Well, still, it won't match blah.ru or something like that :(


Title: Not as general as it needs to be
Name: Randal L. Schwartz
Date: 2/15/2005 10:24:29 PM
Comment:
To match a URL, see the CPAN module "URI::Find". Much more complex than what you list.


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