Replace anchor text with PHP (and regular expression)
问题 I have a string that contains a lot of links and I would like to adjust them before they are printed to screen: I have something like the following: <a href="http://www.dont_replace_this.com">replace_this</a> and would like to end up with something like this <a href="http://www.dont_replace_this.com">replace this</a> Normally I would just use something like: echo str_replace("_"," ",$url); In in this case I can't do that as the URL contains underscores so it breaks my links, the thought was