I'm trying to make an url that adds a /
to all hrefs
and srcs
in a string.
It should only add a /
to urls that don't have a http://
at their beginning and that don't have /
yet also.
If we have this:
<a href="ABC">...
<img src="DEFG">...
<a href="/HIJ">...
<a href="http://KLMN">...
The results should be something like this:
<a href="/ABC">...
<img src="/DEFG">...
<a href="/HIJ">...
<a href="http://KLMN">...
This is what i've come up till now:
&(href|src)="?!(\/|http::\/\/)(.+)"
And the replace would be
$1="/$2"
It isn't working, though.
- What am I doing wrong?
- How would the working regex have to look like