Quantcast
Viewing latest article 36
Browse Latest Browse All 44

Answer by user3040610 for How to replace specific tag with regex in php?

Try this to replace the anchor text to given string with preg_replace,$string = 'dog';$content = 'a quick brown <a href="some-link"> fox</a> jumps over a lazy <a href="another-link"> dog</a>';echo preg_replace('/<a(.+?)>.+?<\/a>/i',"<a$1>".$string."</a>",$content);

Viewing latest article 36
Browse Latest Browse All 44

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>