在php中preg_match()函数是用来执行正则表达式的一个常用的函数,下面我来给大家详细介绍preg_match使用方法. 函数用法 int preg_match_all ( string pattern, string subject, array matches [, int flags] ) 例1 代码如下 复制代码 preg_match_all ("|<[^>]+>(.*)]+>|U","example: this is a test
int preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] ) 例子:preg_match("/php/i", "PHP is the web scripting language of choice.") 关于$pattern,定界符不一定要是 /,如 /string/.当要匹配的字符串里含有 /