/*
代码如下 复制代码
int preg_match_all ( string $pattern , string $subject , array &$matches [, int $flags [, int $offset ]] );
搜索所有匹配正则表达式的模式并提出给予他们在比赛中受的标志指定的顺序。第一场比赛后发现,随后的搜查是继续从最后一场比赛结束。
实例
代码如下 复制代码
preg_match_all(|]+>(.*)[^>]+>|u,
example: this is a test
,
$out, preg_pattern_order);
echo $out[0][0] . , . $out[0][1] . ;
echo $out[1][0] . , . $out[1][1] . ;
出输
代码如下 复制代码
example: ,
this is a test
example: , this is a test
preg_match_all(|]+>(.*)[^>]+>|u,
example:
this is a test
,
$out, preg_set_order);
echo $out[0][0] . , . $out[0][1] . ;
echo $out[1][0] . , . $out[1][1] . ;
int preg_match ( string $pattern , string $subject [, array &$matches [, int $flags [, int $offset ]]] )
搜索主题的经常表达的方式给予配合
$subject = abcdefwww.111cn.net;
$pattern = '/^def/';
preg_match($pattern, substr($subject,3), $matches, preg_offset_capture);
print_r($matches);
array
(
[0] => array
(
[0] => def
[1] => 0
)
)
*/