This is my string:
<ol>
<li>
<a rel="nofollow" href="http://127.0.0.1/index.php/something?price=3%2C25"><span class="price">50,00€</span> - <span class="price">75,00€</span></a> (38)
</li>
<li>
<a rel="nofollow" href="http://127.0.0.1/index.php/something?price=4%2C25"><span class="price">75,00€</span> - <span class="price">100,00€</span></a> (11)
</li>
</ol>
I want to replace
<span class="price">50,00€</span> - <span class="price">75,00€</span>
with "foobar" and
<span class="price">75,00€</span> - <span class="price">100,00€</span>
with "foobar2" for example. The only way to know which line to replace with what, is the price=3 or price=4 part in the URL.
So after the replacement, the string should look like:
<ol>
<li>
<a rel="nofollow" href="http://127.0.0.1/index.php/something?price=3%2C25">foobar</a> (38)
</li>
<li>
<a rel="nofollow" href="http://127.0.0.1/index.php/something?price=4%2C25">foobar2</a> (11)
</li>
</ol>
I tried preg_replace, but it always gets too much of the string. Ideas?
Thanks for helping!