小编nav*_*nic的帖子

在PHP中使用Gruber的正则表达式进行URL匹配

如何在php中使用preg_match处理本文中提到的正则表达式?

<?php
preg_match("\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))/i", $text, $matches);
print_r($matches);
?>
Run Code Online (Sandbox Code Playgroud)

使用上面的代码我收到以下错误:

Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash...
Run Code Online (Sandbox Code Playgroud)

php regex url preg-match gruber

5
推荐指数
1
解决办法
1062
查看次数

标签 统计

gruber ×1

php ×1

preg-match ×1

regex ×1

url ×1