I want to 开发者_开发知识库remove the hostname from all the background css declarations I have in a html page
ie
<div style="background:transparent url(http://www.some-domain.com/images/test.png) no-repeat"></div>
to become
<div style="background:transparent url(images/test.png) no-repeat"></div>
Any ideas guys?
Thanks
replace the regex "http://[^/]*" with "/".
http://(.*?)images
If you do a regex replace, you can then remove the match and you should be ok.
try
(http:\/\/\w.*\/)
and replace the matched pattern with /
精彩评论