PHP 正则匹配 在线等
如 匹配这个input 中的 value
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <input type="text" class="shareIpt j-copyipt" value="xxxxxxxxxxxxxxxxxxxxxxx">
[User:root Time:14:58:15 Path:/home/liangdong/<a style="color:#f60; text-decoration:underline;" title="php" href="https://www.php.cn/zt/15714.html" target="_blank">php</a>]$ 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 <div class="clear"></div>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号