I've written a little javascript to check a domain if it contains invalid chars... Everything works, except the fact that it doesn't detect a '_', and a domain may not contain any '_'.

I have this:

	if( (/^\w+([\-]?\w+)+$/.test(domainstr)) && domainstr!=""){
		return true;
Some examples of domainstrings:
abcd123 => valid (works)
abc-123 => valid (works)
abc.123 => invalid (works)
abc_123 => invalid (doesn't work...)