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.
Bu varsa:
<a href="ABC">...
<img src="DEFG">...
<a href="/HIJ">...
<a href="http://KLMN">...
Sonuçlar böyle bir şey olmalı:
<a href="/ABC">...
<img src="/DEFG">...
<a href="/HIJ">...
<a href="http://KLMN">...
Bu benim bugüne kadar geldim budur:
&(href|src)="?!(\/|http::\/\/)(.+)"
Ve yerini olurdu
$1="/$2"
Ama, çalışmıyor.
- Ben yanlış ne yapıyorum?
- Nasıl çalışma regex gibi bakmak gerekir