Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$str = '<p>this <a href="https://api.slack.com/apps/" target="_blank">link</a> and <a href="https://www.google.com" target="_blank">link 2</a></p>';
$reg = '/<a href=\"([^\"]*)\">(.*)<\/a>/';
preg_match_all($reg, $str, $result);
//var_dump($result);
$text = 'Link to [Google](https://www.google.com/)';
$links = 'Link to <a href="https://www.google.com/">Google</a>';
//echo preg_replace('/\[(.*?)\]\s*\(((?:http:\/\/|https:\/\/)(?:.+))\)/', '[$1]($2)', $links);
$url = preg_match('/<a [^>]*href="?([^">]+)"?>/', $str, $match);
var_dump($match);