网站的含义使用(!preg_match)验证代码

时间:2015-09-04 09:58:25

标签: php regex preg-match

我在PHP中搜索了以下网站验证代码的解释/含义,但没有得到它。 任何线索?

(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website))

1 个答案:

答案 0 :(得分:0)

如果您使用google preg_match,则会找到a php method的引用,该引用会执行正则表达式匹配。

您的代码会检查$ website是否与"之间的模式匹配",如果它没有匹配则返回true。 检查与模式中给出的正则表达式匹配的条件。

preg_match可以被称为:

preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] )

在您的情况下,$pattern"/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i"$subject /输入字符串为$website。这似乎是检查https和ftp。

您可以输入您的模式字符串in a website like this one并将鼠标悬停在每个元素上,以获取其含义的线索。