Re: Help: Validate Domain Name by Regular Express

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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),


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux