Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



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

Posts: 16
Trades: 0
Anybody know a good regular expression that matches all URL's, ie, http and https?
shshao is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-06-2008, 07:14 AM Re: Regular Expression for URL?
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
http://regexlib.com/Search.aspx?k=URL
__________________
Only a biker knows why a dog sticks his head out the window.

Last edited by tripy; 05-06-2008 at 07:15 AM..
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 05-06-2008, 02:57 PM Re: Regular Expression for URL?
Plugin-Developer's Avatar
Weightlifting CS Student

Posts: 504
Name: Nick Ohrn
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
- Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
Plugin-Developer is offline
Reply With Quote
View Public Profile Visit Plugin-Developer's homepage!
 
Old 05-07-2008, 04:53 AM Re: Regular Expression for URL?
Experienced Talker

Posts: 33
Trades: 0
You can use following expression for it


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

For vb script
__________________

Please login or register to view this content. Registration is FREE
bizcredit is offline
Reply With Quote
View Public Profile
 
Old 05-09-2008, 09:30 PM Re: Regular Expression for URL?
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
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

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 05-10-2008, 12:02 AM Re: Regular Expression for URL?
addonchat's Avatar
Super Talker

Posts: 115
Name: Chris Duerr
Trades: 0
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

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
addonchat is offline
Reply With Quote
View Public Profile
 
Old 05-20-2008, 11:35 PM Re: Regular Expression for URL?
Average Talker

Posts: 16
Trades: 0
(ht|f)tp(s?)://([\w-]+\.)+[\w]{2,4}(:[\d]{1,5})?(/[\w\.:_-]+)*[\./]?([\w]{2,4})?([,]\w+)*((\?\w+=[+%\w]+)?(&\w+=[+%\w]+)*([,]\w*)*)?


From http://www.helpglobe.com/Answers.asp...8&search=regex
shshao is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Regular Expression for URL?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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 1.00259 seconds with 12 queries