Portal Home > Knowledgebase > Articles Database > REgex Domain??
REgex Domain??
Posted by justsurge, 01-16-2009, 04:57 PM |
Hi,
can someone give me a snip.
that uses preg_match
to validate a domain and to make sure that only [a-z0-9\-] are present and warn if characters not allowed are??
php. i use perl and have no problem, with php, i get no results,
i just want a warning if non alphanumeric, - are present. sorry, thx!!
eliot
|
Posted by justsurge, 01-16-2009, 05:44 PM |
solved with?
[^a-z0-9\-] thx
|
Posted by code_iain, 01-17-2009, 12:47 AM |
May want to add capitals as a precaution and the "." or all domains will fail at the TLD.
[^a-zA-Z0-9\-\.]
I'm sure there's a more sophisticated way to do this but I'm not sure what it is, this works for me, hope that helps.
|
Add to Favourites Print this Article
Also Read