On Tue, 27 Aug 2002, Shlomi Fish wrote:

> I need a regular expression (as simple as possible) for checking the
> validity of an http://../ URL. I need it to conform with DNS, HTTP and URL
> RFCs as much as possible without being too complex.

Take a look at RFC #2396, you'll find there the following regex:

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

The results are as follow:

$1 = http:
$2 = http
$3 = //www.ics.uci.edu
$4 = www.ics.uci.edu
$5 = /pub/ietf/uri/
$6 = <undefined>
$7 = <undefined>
$8 = #Related
$9 = Related


  Gal Hammer.


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to