1

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
2

1 Answer 1

8

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.