Answers for "php regex markdown link"

PHP
0

php regex markdown link

$text = 'Link to [Google](https://www.google.com/)';
echo preg_replace('/\[(.*?)\]\s*\(((?:http:\/\/|https:\/\/)(?:.+))\)/', '<a href="$2">$1</a>', $text);
// Outputs: Link to <a href="https://www.google.com/">Google</a>
Posted by: Guest on July-28-2021

Browse Popular Code Answers by Language