Example
I received a email-list from my friends but the problem is some people typed an email in full form (
[email protected]) and some people typed (xxx@xxx without .com). And i want to improve it into the same format. How can i improve it if i want to edit them on vi?
In my emaillist.txt
foo@gmail
[email protected]
bas@gmail
[email protected]
mike@abc
john@email
My try:
i tried to use an easy regex like this to catch the pattern like xxx@xxx
:%s/\(\w*@\w*\)/\0.com/g
and
:%s/\(\w*@\w*[^.com]\)/\0.com/g
But the problem is this regex include
[email protected] also
And the result become like this after i enter the command above
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
So, My expectation after substitution is should be like this:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
How to use regex in this situation?