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
You may do the following:
- Use your regex to find all emails, click Find All to select all emails
- Go to
Selection
and clickInvert Selection
- Press Enter to add line breaks between the found emails. Or, press , or any other key to insert anything to delimit found matches.
来源:https://stackoverflow.com/questions/52450052/delete-all-text-but-matches-in-sublimetext