Delete all text but matches in SublimeText

2020-04-12 16:33发布

I am trying to delete all strings except emails in sublime.

So i can look for emails like this

[a-zA-Z0-9.!#$%&'+-/=?\^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[\.a-zA-Z0-9-]+)

But how do i delete everything else?

Thanks

1条回答
我欲成王,谁敢阻挡
2楼-- · 2020-04-12 17:13

You may do the following:

  • Use your regex to find all emails, click Find All to select all emails
  • Go to Selection and click Invert Selection
  • Press Enter to add line breaks between the found emails. Or, press , or any other key to insert anything to delimit found matches.
登录 后发表回答