I have a database of emails. like below, i want to filter out those emails are not correct.
for eg:
- if email is not having "."
- if email have more than one "@"
- if email have more than one "." before and after "@"
- if email have spaces inside email or outside email.
- if email have domain other than "gmail.com" like (hotmail.com, live.com)
please help me like this if in future i will found anything to amend than i can add more conditions.
df <- data.frame(email=c("abc@gmail.com","def@gmail.com","ghi@gmail.com","jkl@gmail.com","mno@gmail.com","pqr@hotmail.com","st@u@live.com","vwx@gmail.com","yza@gmail.com","a.a.b@gmail.c.om",
"aac@gmail.com","abb@gmail.com","abc@gmail.com","cab@gmailcom","dfc@gmail.com"))
for example the output be like
not_having"." | more than 1 "@" | ||
---|---|---|---|
abc@gmail.com | 0 | 0 | 0 |
def@gmail.com | 0 | 0 | 0 |
ghi@gmail.com | 0 | 0 | 0 |
jkl@gmailcom | 1 | 0 | 0 |
mno@gmail.com | 0 | 0 | 0 |
pqr@hotmail.com | 0 | 0 | 0 |
st@u@live.com | 0 | 1 | 0 |
vwx@gmail.com | 0 | 0 | 0 |
yza@gmail.com | 0 | 0 | 0 |
a.a.b@gmail.c.om | 0 | 0 | 1 |
aac@gmail.com | 0 | 0 | 0 |
abb@gmail.com | 0 | 0 | 0 |
abc@gmail.com | 0 | 0 | 0 |
cab@gmailcom | 0 | 0 | 0 |
dfc@gmail.com | 0 | 0 | 0 |