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 = '<a href="http://example.com/tool/document.php?id=208" target="_blank">document requirementsd</a>'; $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
Post a Comment