I have a string that looks like this:
Bla bla %yada yada% bla bla %yada yada%
Is there a way to replace only the first two "%" (or the last two) so I can get the next output:
Bla bla <a href='link1'>yada yada</a> bla bla %yada yada%
and also, if necessary, the last two "%" so it outputs:
Bla bla <a href='link1'>yada yada</a> bla bla <a href='link2'>yada yada</a>
I can't figure out how to make the distinction between the first two and the last two so, if I want, I can be able to replace either the first or the last two marks "%" with a link. I'm using php. Thanks in advance
Regards
%, it can cause a lot of errors a lot of different ways. You can get creative with thestrposfunction for it though./(%[^%]+%)/g