php preg_match函数和php preg_match_al函数l实例,方法,例子

来源:互联网 发布:小语网络加速器注册 编辑:程序博客网 时间:2024/06/05 07:28

preg_match_all函数的使用实例:
preg_match_all() 函数用于执行一个全局正则表达式匹配。

preg_match_all() 将实现全部结果的匹配,如果要匹配成功一次后停止匹配,请使用 preg_match() 函数。

语法:preg_match_all (pattern , subject, matches)参数  描述pattern 正则表达式subject 进行匹配的字符串matches 所有匹配结果(数组)<?php   $userinfo = "Name: <b>John Poul</b> <br> Title: <b>PHP Guru</b>";   preg_match_all ("/<b>(.*)<\/b>/U", $userinfo, $pat_array);   print $pat_array[0][0]." <br> ".$pat_array[0][1]."\n";?>输出结果:John Poul PHP Guru

http://www.manongjc.com/article/54.html

原创粉丝点击