PHPize Online / SQLize Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy
Copy Format Clear
<?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);
Show:  
Copy