For domain registration I would like to add some verification, just in case if someone would like to go crazy and enter some weird domain names.
This is what I have now:
preg_match('/[^a-zA-Z0-9]/', $domain)
I would like to also add "-" but it cannot be the first or last character. The $domain has to be 2 or more characters at least. and cannot start or end with "-".
RegEx Gurus: any idea how to make this simple? Thank you!