3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isUrl($text) { $regex = array(); $regex["url"] = '/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[.\!\/\\w]*))?)/i'; $mat = array(); echo $regex["url"]; preg_match($regex["url"], $text, $mat); var_dump($mat); if ($mat[0]) { echo $mat[0]; } } isUrl("来戳这里!http://aaa.bb.cc sdfsafsdhttp://aa.bb.com");

preferences:
49.21 ms | 402 KiB | 5 Q