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);
------解决方案--------------------咦。不是可以的么?
1 | <br /> preg_match_all( '/(src<br><font color=' #FF8000 '>------解决方案--------------------</font><br>width<br><font color=' #FF8000 '>------解决方案--------------------</font><br>flashvars<br><font color=' #FF8000 '>------解决方案--------------------</font><br>height)=(["\'])?([^\'" ]*)(?(2)\2)/i' , $str , $matches );
|
Nach dem Login kopieren