首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

PHP 正则匹配

2012-06-12 
PHP 正则匹配在线等如 匹配这个input 中的 valueHTML codeinput typetext classshareIpt j-copyipt

PHP 正则匹配 在线等
如 匹配这个input 中的 value

HTML code
<input type="text" class="shareIpt j-copyipt" value="xxxxxxxxxxxxxxxxxxxxxxx">


[解决办法]
'/<input.*? class="shareIpt j-copyipt" value="([^\"]+)"/'
[解决办法]
PHP code
[User:root Time:14:58:15 Path:/home/liangdong/php]$ cat preg.php <?php$str = <<<EOF<input type="text" class="shareIpt j-copyipt" value="xxxxxxxxxxxxxxxxxxxxxxx">EOF;$nmatches = preg_match('/class="shareIpt j-copyipt" value="(.*)"/iUs', $str, $matches);echo $matches[1] . PHP_EOL;?>[User:root Time:14:58:16 Path:/home/liangdong/php]$ php preg.php xxxxxxxxxxxxxxxxxxxxxxx 

热点排行