Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
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);
Copy Clear