开发者

Need help with regex Email in Notepad++

开发者 https://www.devze.com 2023-01-13 18:18 出处:网络
I have a list with contacts each line, we have to replace the whole line in to single email: Name, Surname, Address, Email, Phone

I have a list with contacts each line, we have to replace the whole line in to single email:

Name, Surname, Address, Email, Phone

=> Email

I know how to find email, but I need smth like find and replace to "" everything b开发者_Python百科ut Email


This worked for me using Notepad++ to remove everything except for the email addresses:

  1. Ctrl + H to bring up Find/Replace dialog box.
  2. Change to the the Replace tab.
  3. Find what: ^.*(\<[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z][A-Za-z][A-Za-z]?[A-Za-z]?\>).*$
  4. Replace with: \1
  5. You need to select [Regular Expression] at the bottom of the Find/Replace dialog box.
  6. Then click [Replace All]


Assuming your email regular expression is well-written and won't match anything that isn't an email...

Find (() characters are significant):

^.*(your email regex here).*$

Replace with:

\1


I don't think you can replace "everything except" any regex in notepad++. I usually use macros for such a problem.

But another method would it be, to import the data into Excel as a CSV, mark the column with the email adresses and copy-paste them to notepad++. That's another trick I usually do.

0

精彩评论

暂无评论...
验证码 换一张
取 消