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]> I am needing to validate the contents of an EditField as a properly
> formatted URL. Does someone have a good suggestion on how to >
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
"://" 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>
|