Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete all text but matches in SublimeText

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

like image 486
Guru Surfer Avatar asked Sep 18 '25 14:09

Guru Surfer


2 Answers

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.
like image 57
Wiktor Stribiżew Avatar answered Sep 20 '25 09:09

Wiktor Stribiżew


For those who are looking for a latest answer, after clicking Find All, then just do copy (ctrl + v), open new text, paste (ctrl + v).

like image 35
muhammed ozbilici Avatar answered Sep 20 '25 09:09

muhammed ozbilici