Extracting Email Addresses Only
Moderators: AmigoJack, bbadmin, helios, MudGuard
Extracting Email Addresses Only
I just extracted over 10K user accounts from our forum and it ended up in this format:
username user@email.com
How can I extract only the email address from this line? I tried bookmarking "@", but it picked up the username also. Any thoughts?
username user@email.com
How can I extract only the email address from this line? I tried bookmarking "@", but it picked up the username also. Any thoughts?
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
Hi Bob,
Thanks but it seemed to remove all the lines but one. The text file is listed with over 10K lines like this:
-------------------------------------
username1 email@email1.com
username2 email@email2.com
username3 email@email3.com
-------------------------------------
I want it to end up like this:
-------------------------------------
email@email1.com
email@email2.com
email@email3.com
-------------------------------------
Thanks!
Thanks but it seemed to remove all the lines but one. The text file is listed with over 10K lines like this:
-------------------------------------
username1 email@email1.com
username2 email@email2.com
username3 email@email3.com
-------------------------------------
I want it to end up like this:
-------------------------------------
email@email1.com
email@email2.com
email@email3.com
-------------------------------------
Thanks!
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
Just took your last example.
I end up with this:
-------------------------------------
email@email1.com
email@email2.com
email@email3.com
-------------------------------------
Looks the same to me. What am I not seeing?
I end up with this:
-------------------------------------
email@email1.com
email@email2.com
email@email3.com
-------------------------------------
Looks the same to me. What am I not seeing?
Hope this was helpful.............good luck,
Bob
Bob
.+ is greedy, so if there is a blank at the end of the line, it removes all.
use
^[^[:blank:]]+[[:blank:]]
instead, i.e. search for as many non-blanks as possible at the beginning of the line plus one blank after that.
If your user names can contain blanks, it gets more complicated:
^.*[[:blank:]]([^[:blank:]]+@)
replace by \1
use
^[^[:blank:]]+[[:blank:]]
instead, i.e. search for as many non-blanks as possible at the beginning of the line plus one blank after that.
If your user names can contain blanks, it gets more complicated:
^.*[[:blank:]]([^[:blank:]]+@)
replace by \1
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm