Reply
Regular Expression for URL?
Old 05-06-2008, 04:44 AM Regular Expression for URL?
Average Talker

Posts: 15
Anybody know a good regular expression that matches all URL's, ie, http and https?
shshao is offline
Reply With Quote
View Public Profile
 
Sponsored Links (We share ad revenue):
 
Old 05-06-2008, 06:14 AM Re: Regular Expression for URL?
tripy's Avatar
Fetchez la vache!

Latest Blog Post:
Pretty pretty please….
Posts: 1,689
Name: Thierry
Location: In the void
http://regexlib.com/Search.aspx?k=URL
__________________
Listen to the ducky: "This is awesome!!!"


Last edited by tripy : 05-06-2008 at 06:15 AM.
tripy is offline
Reply With Quote
View Public Profile
 
Old 05-06-2008, 01:57 PM Re: Regular Expression for URL?
nickohrn's Avatar
Weightlifting CS Student

Posts: 451
Name: Nick Ohrn
There are a ton of resources out there that give regexes for matching regular expressions. Most of them don't match at least one variation of address, so you'll probably have to compromise, at least a bit. The resource above is a good one, as is this one.
__________________
NickOhrn.com - My personal haven of insight to offer the world.
Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
nickohrn is offline
Reply With Quote
View Public Profile Visit nickohrn's homepage!
 
Old 05-07-2008, 03:53 AM Re: Regular Expression for URL?
Experienced Talker

Posts: 33
You can use following expression for it


/(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)/

For vb script
__________________
Explode Business Credit E-Book
bizcredit is offline
Reply With Quote
View Public Profile
 
Old 05-09-2008, 08:30 PM Re: Regular Expression for URL?
JeremyMiller's Avatar
Full-Time TeraTasker

Posts: 627
Name: Jeremy Miller
Location: Reno, NV
If you stated the purpose, then we could be more assistive. In PHP, I use http://www.php.net/parse_url and then performs tweaks depending on my purpose.
__________________
Jeremy Miller - TeraTask Technologies, LLC
Content Farmer - Automated Posting for Content & Blog Sites
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 05-09-2008, 11:02 PM Re: Regular Expression for URL?
addonchat's Avatar
Skilled Talker

Posts: 97
Name: Chris Duerr
Quote:
Originally Posted by shshao View Post
Anybody know a good regular expression that matches all URL's, ie, http and https?
What do you want? Do you just need to identify a URL in a string? Are you building a regex to match a URL and parse parameters? If so, what do you need? E.g., the protocol, the domain, subdomain, HTTP auth usernameassword, individual GET parameters, etc..?

For efficiency, it's often wise to construct a regular expression to meet your specific needs, nothing more.
__________________
Chris Duerr
AddonChat Java Chat Software
http://www.addonchat.com/ - Affiliate Program
addonchat is offline
Reply With Quote
View Public Profile
 
Sponsored Links (We share ad revenue):
 
Reply     « Reply to Regular Expression for URL?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML


Page generated in 0.15888 seconds with 14 queries