I have a dataframe consisting of multiple unclean email addresses, for example
1) abc@gmailcom 2) def@yahoo.commm 3) fgh@yahoo.coin 4) xyz@gmail
I want to use gsub to clean these emails with the use of another dataframe which will contains patterns and replacements like,
- if pattern found is 'comm' them replace with 'com'
- if pattern found is '.coin' them replace with '.co.in'
- if pattern found is 'gmail' then replace with 'gmail.com' (like in case 4 above,but here I don't want to replace emailids of type abc@gmail.com)
Can someone please suggest a gsub regex.