preg_replace links in text with <a> with some exception
问题 <?php // I have a string, something like this: $string = ' Lorep ipsum <a href="http://www.example.com">example</a> lorem ipsum lorem ipsum http://www.example.com/index.php?param1=val¶m2=val lorem ipsum '; // I need to do some magick with preg_replace and get string like this: $string = ' Lorep ipsum <a href="http://www.example.com" target="_blank">example</a> lorem ipsum lorem ipsum <a href="http://www.example.com/index.php?param1=val¶m2=val" target="_blank">http://www.example.com