I have a string with several lines of CSS code. I want to match all occurences of :
background:url(" url ");
and remove everything except the filename.
Example input:
background:url("http://external_link.com/images/my_suspicious_file.png");
background:url("rubish.com/images/my_suspicious_file.jpg");
background:url("retarded_input/folder/flodder/my_suspicious_file.gif");
Expected output
background:url("my_suspicious_file.png");
background:url("my_suspicious_file.jpg");
background:url("my_suspicious_file.gif");
Search pattern:
Replace pattern:
You’ll need to escape the strings above for PHP, and I’m assuming you are not using the
soption (single line).Update
With everything on the same line:
Same replace pattern.