I want to find every instance of a background image in a CSS document and comment it out:
background: url('images/test.jpg') no-repeat top left;
becomes
background: /*url('images/test.jpg')*/ no-repeat top left;
I'm having trouble escaping the * and / (don't want to comment out the entire background selector).
couldn't you just put in the search box url('images/test.jpg')
and in the replace box: /*url('images/test.jpg')*/
(thus avoiding regular expressions at all)?
Setting the options 'search in:' to 'current document' and 'search for:' to 'source code', then hitting 'replace all'..
Something like this should work:
search for
background:(\s*url\s*\([^)]+\))
replace with
background:/*$1*/
You shouldn't have to escape the * and / in the replacement text
Search for :
(background)(.*)(url\('.*[^']'\))(.*)
Replace with :
$1$2/*$3*/$4
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.