Atom.io search and delete, is it possible?

Has anyone understood how to use the Atom.io function to find and delete strings? For example, I want to remove all lines matching ^\s*color: #3f3f3f;$ from my css.

I do not want to leave blank lines.

+5
source share
3 answers

Since $ does not match a newline or carriage return, I should be more explicit. Sample \n?\r? seemed to help.

My last regex:

^\s*color: #3f3f3f;\n?\r?

You may need to change it depending on line endings. I think ^\s*color: #3f3f3f;\n?\r?\n? should be pretty versatile.

+5
source

You can simply replace this match with an empty string, i.e. Leave the Replace in current buffer field blank and make Replace .

You must take care to combine the entire line so that you do not end the empty line.

+2
source

I just tested it, and if you just leave the replace field empty, click replace, it will delete.

+1
source

Source: https://habr.com/ru/post/1241529/


All Articles