Home > Backend Development > PHP Tutorial > PHP 正则匹配

PHP 正则匹配

WBOY
Release: 2016-06-13 10:27:31
Original
948 people have browsed it

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

HTML code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><input type="text" class="shareIpt j-copyipt" value="xxxxxxxxxxxxxxxxxxxxxxx">
Copy after login


------解决方案--------------------
'/------解决方案--------------------
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<div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template