PHP Remove specific URL from html string -


i trying remove specific url text string. have working part need include both http or https versions of link.

$link = '&lt;a href=&quot;http://example.com/tool/document.php?id=208&quot; target=&quot;_blank&quot;&gt;document requirementsd&lt;/a&gt;';  $result = preg_replace('/<a href=\"http:\/\/' . $_server["server_name"] . '\/tool\/document.php\?id=(.*?)\">(.*?)<\/a>/', "\\2", htmlspecialchars_decode($html)); 

whats best way make sure both http , https links stripped?

you can use (http|https):\/\/ match both http or https!


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -