I am a beginner, not a specialist in Perl nor RE, but here is the simplest
possible. It might help a little:

/^[\w\.\-]$/;

A domain name can be localhost, or something with less letters, so a very
restrictive RE won't be correct, but this RE could avoid more errors.


Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

----- Original Message -----
From: "Gisle Aas" <[EMAIL PROTECTED]>
To: "Octavian Rasnita" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, November 26, 2002 9:52 PM
Subject: Re: Can the URI module be improved?


"Octavian Rasnita" <[EMAIL PROTECTED]> writes:

> I saw that the URI module returns a $uri -> host even though the URL used
is
> not a correct one.
>
> For example I've seen bad addresses like:
>
> http://www:site.com/
>
> This is a wrong address but the host method returns "www:site.com".
>
> I think it is a good idea to return a null value instead.

What RE do you suggest to apply to validate hostnames?

Regards,
Gisle


Reply via email to