I have a var baseURL
that I know is: baseURL = c:\whatever\mybasedir\
I have an HTML source code that may contain this:
<IMG alt="foo" src="file://c:\whatever\mybasedir\root\foo\bla.gif">
or/and:
<IMG alt="foo" src="file://c:/whatever/mybasedir/root/foo/bla.gif">
or/and:
<IMG src="c:\whatever\mybasedir\root\foo\bla.gif">
or/and:
<IMG src="c:\whatever\mybasedir/root/foo/bla.gif">
I need to replace all src tags so that result path is Unix style relative to baseURL
:
<IMG src="root/foo/bla.gif">
or if there was an alt attribute (or other. order of attributes may vary):
<IMG alt="foo" src="root/foo/bla.gif">
How do I match <IMG * src="*" *>
?
Any ideas what RegEx (or other method) can help here?
(I cannot use DOM to do this job, since the IE8/9 DOM is causing this situation in the first place - automatically adding <base href>
to all relative src tags)