Per exampe for:
<a href="http://www.google.com">http://www.google.com</a>
convert to
http://www.google.com
in plain text not hyperlink using preg_replace in php.
Per exampe for:
<a href="http://www.google.com">http://www.google.com</a>
convert to
http://www.google.com
in plain text not hyperlink using preg_replace in php.
You must use the following code:
$content = '<a href="http://www.google.com">http://www.google.com</a>';
$unlinked_content = preg_replace('#<a.*?>(.*?)</a>#is', '$1', $content);
I used the 's' modifier for multilined links.
But if you are trying to create an legible piece of text you must to encapsulate the unlinked content using something like [$1]
as the second parameter of preg_replace function.
If you want to learn about regex, I recomend the regex101 page.
preg_replace('#<a.*?>(.*?)</a>#i', '\1', $text)