Regular expression

Discussion in 'PHP' started by ssimon171078, Jun 26, 2015.

  1. #1
    i have this html code i need to download all doc file how can i build regular expression to find this links:
    for example i need to receive this link :
    http://skatc.com/resume/Resume%2520-%2520Sarah%2520Collins.doc

    <div id="res"><div id="topstuff"></div><div id="search"><div id="ires"><ol><li class="g"><span style="float:right"><span dir="ltr" class="mime">[DOC]</span>&nbsp;</span><h3 class="r"><a dir="ltr" href="/url?q=http://skatc.com/resume/Resume%2520-%2520Sarah%2520Collins.doc&amp;sa=U&amp;ei=HGGNVa65Jsb9Uqbuk6AB&amp;ved=0CBcQFjAA&amp;usg=AFQjCNEivjreEwg-JFI5buWcIHmqPwRr4g"><b>Resume</b> of Sarah Collins, <b>Web Developer</b></a></h3><div class="s"><div class="kv" style="margin-bottom:2px"><cite><span dir="ltr">skatc.com/<b>resume</b>/<b
    HTML:
     
    ssimon171078, Jun 26, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Depends. Is this code you have direct access to? If so, you shouldn't really need a reger, you should be able to parse the code using the built in dom functions of PHP. But, for a regular expression, you'd search for the url?q= and then just parse the url after and before &amp;sa
     
    PoPSiCLe, Jun 26, 2015 IP