Reputation: 11652
I am trying to extract email addresses from notepad++ using RegEx.
I tried like this
Find and Replace
Find: (\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b)
Replace : .\1
I am loosing email address instead of text. I need remove all text and keep only email addresses in the file. How to do that?
Abilash Perumandla
hi Gunpreet, kindly share your thoughts to [email protected]
Pratap Aneel
15d
Pratap Aneel
please share your thoughts to [email protected]
naveen kumar
15d
naveen kumar
Upvotes: 1
Views: 12277
Reputation: 626689
You need to match and capture the email with a (...)
subpattern (so, you do that right), but you need to just match everything else (and that part is missing).
Use
Find what: (\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b)|.
Replace with: $1
Then, you might want to use Edit -> Blank Operations -> Remove Unnecessary Blank and EOL menu option.
Upvotes: 9