In postgres I'm using regexp_replace to clean up some yahoo email addresses.
SELECT regexp_replace(domain,'yahoo\.co[^\.].*','yahoo.com') FROM table
Unfortunately, this expression matches this type yahoo.com.tw that I'd like to NOT MATCH. I'd like the regex to:
NOT MATCH:
yahoo.es
yahoo.co.jp
yahoo.com.tw
MATCH:
yahoo.com,
yahoo.com.
yahoo.com'
I've been at this for several hours and have looked at several links in stack like this: Regular expression to match a line that doesn't contain a word?
They have helped me write a negative lookahead but can't seem to combine it with the yahoo portion
NEGATIVE LOOKAHEAD
^(?!.*(\.com?\.|\.[a-z]{2})).*$
Here is the regex101 data and formula.
Any suggestions would be much appreciated. Thank you.