Looking for hostname validation regex.
Regular expression to match DNS hostname or IP Address?
In that link gentlemen propose a decent regex. I have a few problems/questions with that:
- On windows computers/networks names
like
1abcd
are allowed (verified on our local network) - In the proposed regex the dot might appear only once. I'd assume
that
abc.def.gh
is a valid hostname as well, isn't it.
Strange, but also couldn't find any .NET class that can validate hostname string (is it the situation?). Any advice will be highly appreciated.
Update: for any class/method proposal - please advice something that will work both in .NET/C# and SilverLight.