Home > Backend Development > PHP Tutorial > 帮忙解决个php正则,该怎么处理

帮忙解决个php正则,该怎么处理

WBOY
Release: 2016-06-13 10:46:04
Original
841 people have browsed it

帮忙解决个php正则

HTML code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
Copy after login
  • 尤物一枚 骚年一个


  • 请帮忙用preg_match_all 从
  • (.*)
  • 写个正则, 取出里边里的字符, 

    整段代码只要
    里的字符赤裸裸的: '尤物一枚 骚年一个' 其他多余的字符和标签都不要,

    因为
    有可能一个, 有可能多个, 所以请用是就匹配的代码

    最重要的 是定要 preg_match_all("/
  • (.*?)/is",$path,$str); 从
  • 开始截取 到
  • 结束 然后里边正则取字符

    谢谢各位

    ------解决方案--------------------
    先取出每个li,然后再匹配a标签

    preg_match_all("/
  • (.*?)/is",$path,$str);

    foreach($str[1] as $v){
    preg_match_all('/>([^/isU',$v,$m[]);
    }
    print_r($m);
    ------解决方案--------------------
    PHP code
    $path='
    Copy after login
  • 尤物一枚 骚年一个
  • ';preg_match_all("/
  • (.*?)/si",$path,$str);preg_match_all("/target=\"_blank\">(.*?)/si",$str[1][0],$content);print_r($content[1]);
  • 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