i have whole page in html and before output i want to replace all img src for data-src i am using
return (preg_replace('~<img[^>]*\K(?=src)~i','data-',$buffer));
but this doesnt match for example
<img alt="alt" src="src">
it only matches when the src is first
<img src="src"
I cant get it to work like i want, can you help me edit this pattern to do what i need?