Your regular expression was nearly correct. Just the .
is short for "any character", not just for ".". So, try this regex:
/([0-9a-z-]+\.)?[0-9a-z-]+\.[a-z]{2,7}/
Remember that new top level domains are introduced. They do not use latin characters. Take a look at http://many.at/idntlds/.
About excluding “mydomain.com”: You would have to check for this after applying the regular expression.