What I'm trying to do is update the URLs of HTML background tags in a document. The caveat being only local URLs should be updated, so anything starting http should be ignored.
The RegEx I'm trying to achieve needs to replace the path before the filename & extension. so for example:
background="image.gif"
background="/image.gif"
background="images/image.gif"
background="images/directory/image.gif"
should all output as:
background="/mydirectory/image.gif"
As always, both single or double quotes may have been used in the input file.
I already have an existing RegEx that is doing a very similar job for the CSS image references. The RegEx is:
url\((?:\'|\"")?(?!(?:http|ftp))(?<path>.+)\/(?<filename>.*?)\1?\)
I thought I would simply be able to replace the url() match with background= but so far I've not been successful.
Any help greatly apprechiated.