PHP头条
热点:

php正则,该如何处理


php 正则
字符串如下:
height=450 type=application/x-shockwave-flash width=1000 src=http://max.flash34.com/u_90928/0cb4272311a2cfa5710e613e0600ae93.swf

写一个正则,获取height、src、width的值,有些有单引号的,有些双引号的,有些又没有,我的正则只能获取单引号和双引号的。如下:

preg_match_all('/(src|width|flashvars|height)=([\"|\'])?(.*?)(?(2)\2|\s)/is', $str, $matches);
------解决方案--------------------
咦。不是可以的么?
	
    preg_match_all('/(src
------解决方案--------------------
width
------解决方案--------------------
flashvars
------解决方案--------------------
height)=(["\'])?([^\'" ]*)(?(2)\2)/i', $str, $matches);
 

www.phpzy.comtrue/phprm/17341.htmlTechArticlephp正则,该如何处理 php 正则 字符串如下: height=450type=application/x-shockwave-flashwidth=1000src=http://max.flash34.com/u_90928/0cb4272311a2cfa5710e613e0600ae93.swf 写一个正则,获取height、src、width的值,有些有...

相关文章

PHP之友评论

今天推荐