There are different types of links in the text.
http://www.example.ru/link
https://www.netsik.com/resource/

and not such a view

 <a target="_blank" href="http://www.example.ru/link">ссылка</a> 

Found such code, but it removes only a specific link.
How to make all links delete?

 $html = preg_replace("|http://domain.ru|Uis", "#", $html); 

    2 answers 2

    And why do you need a blank link? If not needed, look towards strip_tags

    • strip_tags removes all tags from the line except those allowed. The author most likely meant all the text as html, with other tags. To remove links, you need to register all the allowed tags. $html = strip_tags($html, '<div><p><span>...') - Mr. Black
     $html = " <a target='_blank' href='http://www.example.ru/link'>ссылка 1</a> <a target='_blank' href='http://www.motherfucker.ru'>ссылка 2</a> "; $html = preg_replace("!http(.*?)'!", "#'", $html); 

    Checked, it seems to work

    s

    Even with attributes after the link

    <a target='_blank' href='http://www.example.ru/link' value='link'>ссылка 1</a>

    you