I have a text file in which I have many urls like http://96.156.138.108/i/01/00382/gbixtksl4n0p0000.jpg#xywh=0,0,108,60
I want to change all urls with my urls http://testing.to/testing/vtt/vt1.vtt#xywh=0,0,108,60
I use this regex
$result = preg_replace('"\b(https?://\S+)"', 'http://testing.to/testing/vtt/vt1.vtt', $result);
but its not working well its changing the whole url
from this http://96.156.138.108/i/01/00382/gbixtksl4n0p0000.jpg#xywh=0,0,108,60
to that http://testing.to/testing/vtt/vt1.vtt
I want to change only the url except # xywh == 0,0,108,60 , like this
http://testing.to/testing/vtt/vt1.vtt#xywh==0,0,108,60
source
share