Re: Still REG EX
| From: | Miguel Cruz | Date: | Sun, 24 Mar 2002 00:56:37 +0000 |
| Subject: | Re: Still REG EX | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89876@lists.php.net to get a copy of this message | ||
On Sun, 24 Mar 2002, John Fishworld wrote:
>> On Sun, 24 Mar 2002, John Fishworld wrote:
>>> I'm still playing about trying to validate an url
>>> www(dot)something(dot)something !
>>>
>>> I thought this would work but know
>>>
>>> if (ereg("^(w{3})(\\.)([a-zA-Z]+)(\\.)([a-z]{2,4})$", $str))
>>
>> First of all, web server hostnames don't need to start with www. Secondly,
>> they can have any number of components (separated by periods) from 1 to
>> dozens. Thirdly, the last term doesn't have to be 4 characters or less.
>>
>>> ([a-z]{2,4})$ = at least 2 leters eg de but upto 4 eg info
>>
>> .museum...
>
> Okay good point but still why doesn't it work ?
Seems to work for me, given your questionable intentions. What happens
when you try it?
I just thought of one more problem. Domain name components can also
contain numbers and hyphens.
miguel