realbasic-nug
[Top] [All Lists]

Re: Validate URL

To: realbasic-nug at lists dot realsoftware dot com
Subject: Re: Validate URL
From: "Steven Hedgepeth" <aqualion at excite dot com>
Date: Thu, 31 Aug 2006 02:49:37 -0400 (EDT)
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
 
Thanks Phil for this explaination.  What resourses are available that elaborate 
on what you've written?  Why can't a valid URL, for example, have any 
spaces?Sincerely,Steven HedgepethFrom: Phil M [mailto: phil at mobleybros dot 
com]&gt; I am needing to validate the contents of an EditField as a properly  
&gt; formatted URL.  Does someone have a good suggestion on how to  &gt; 
accomplish this?  Perhaps a REGEX?This is probably more than you want to hear, 
but here it goes...There are basically two parts to a URL (but sometimes 
three); the  protocol and the address.  These parts are separated by a 
&quot;://&quot;  string.  So the first task is to separate the protocol from 
the  address, which you can do like this:   Function IsValidURL(source As 
String) As BooleanSince a valid URL *cannot* have any spaces, it is easy to 
test for  them and reject the URL if there are any.  The Trim() function below  
removes any whitespace in the front or at the end of the string, so  you can 
ignore any 
accidental invisible characters.  We only really  want to reject the string if 
there is a space within the URL.

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>