Home >Backend Development >PHP Tutorial >请问这段内容怎么用正则 进行匹配

请问这段内容怎么用正则 进行匹配

WBOY
WBOYOriginal
2016-06-13 10:24:12777browse

请教这段内容如何用正则 进行匹配


 
Username

 

 
Password

 

   

 
请问这段内容怎么用正则 进行匹配

<script>function captchareload2(){<br />$("#captchaimglogin").attr('src','modules/captcha/captcha.php?r=login&x=34&y=75&z=119&?newtime=' + (new Date()).getTime());<br />}</script>

 

   
 

 


===========================================
上面这段内容:

1、把
请问这段内容怎么用正则 进行匹配

<script>function captchareload2(){<br />$("#captchaimglogin").attr('src','modules/captcha/captcha.php?r=login&x=34&y=75&z=119&?newtime=' + (new Date()).getTime());<br />}</script>
,取出来,用正则匹配

2、匹配 在
里是否包含 第1点 的内容,有包含 输出真,没包含输出假

=======================================

我是在搞不懂了,请帮帮忙

------解决方案--------------------
PHP code
 $s=  <div style="padding-bottom:5px">Username</div>  <div style="padding-bottom:5px"><input type="text" name="username" style="width:180px"></div>  <div style="padding-bottom:5px">Password</div>  <div style="padding-bottom:5px"><input type="password" name="password" style="width:180px"></div>      <div style="padding-bottom:5px">
<div style="padding:5px 0px"><a href="javascript:void(0);" onclick="captchareload2();"><img  src="modules/captcha/captcha.php?r=login" id="captchaimglogin" border="0" alt="请问这段内容怎么用正则 进行匹配" ></a></div>
<script>function captchareload2(){$("#captchaimglogin").attr('src','modules/captcha/captcha.php?r=login&x=34&y=75&z=119&?newtime=' + (new Date()).getTime());}</script>
</div>  <div style="padding-bottom:5px"><input type="text" name="captcha" id="captcha_login" style="width:180px"></div>      <div style="padding-bottom:5px"><input type="submit" name="login" value="Login" class="orange"></div>  html;preg_match('/<div style="padding-bottom:5px"><div style="padding:5px 0px">.+(?=javascript:void\(0\)).+/s',$s,$m);print_r($m);<div class="clear">
                 
              
              
        
            </div>
</div></div>
Statement:
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