This pattern will match everything directly below your yahoo REPLACE section and non of the good cases above: ^yahoo.com?(?:(?!.[a-z]{2}).)*(?:.com?)?$
IE you do not want to include yahoo.fr or yahoo.com.fr or yahoo.co.uk