Re: Re: Help: Validate Domain Name by Regular Express
| From: | Per Jessen | Date: | Sun, 09 Jan 2011 11:15:04 +0000 |
| Subject: | Re: Re: Help: Validate Domain Name by Regular Express | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-310616@lists.php.net to get a copy of this message | ||
Tamara Temple wrote:
> On Jan 8, 2011, at 2:22 PM, Al wrote:
>
>>
>>
>> On 1/8/2011 3:55 AM, WalkinRaven wrote:
>>> PHP 5.3 PCRE
>>>
>>> Regular Express to match domain names format according to RFC 1034
>>> - DOMAIN
>>> NAMES - CONCEPTS AND FACILITIES
>>>
>>> /^
>>> (
>>> [a-z] |
>>> [a-z] (?:[a-z]|[0-9]) |
>>> [a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9]) ) # One label
>>>
>>> (?:\.(?1))*+ # More labels
>>> \.? # Root domain name
>>> $/iDx
>>>
>>> This rule matches only <label> and <label>. but not
>>> <label>.<label>...
>>>
>>> I don't know what wrong with it.
>>>
>>> Thank you.
>>
>>
>>
>> Look at filter_var()
>>
>> Validates value as URL (according to »
>> http://www.faqs.org/rfcs/rfc2396) ,
>>
>
>
> I'm wondering what mods to make for this now that unicode chars are
> allowed in domain names....
You're talking about IDNs ? The actual domain name is still US-ASCII,
only when you decode punycode do you get UTF8 characters.
--
Per Jessen, Zürich (10.1°C)