Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

Retreiving url from a tag using preg_match_all

Last post 05-11-2008, 7:36 PM by Aussie Susan. 1 replies.
Sort Posts: Previous Next
  •  05-09-2008, 6:07 PM 42095

    Retreiving url from a tag using preg_match_all

    Hi, I have a problem I can't seem to get past so its time to ask for help, I'm trying to extract url's
    from a link that looks like this:

    <a href="http://www.somedomain.com/linktopage">[1]</a>



    my guess was to use something like this, but I'm probably way off, but I used it because
    it was very important to me it match all links with [1] within the <A>:

    #href://(.*?)">\[1\]</a>#



    any help would be appreciated.
    Filed under:
  •  05-11-2008, 7:36 PM 42113 in reply to 42095

    Re: Retreiving url from a tag using preg_match_all

    Without knowing what problems you are actually having, the only thing I can see is that your pattern is looking for the characters "://" immediately after the "href" text and ther are none in your example text. If you remove those additional characters from the pattern, then it will match the text.

    If this is not the answer you are looking for, then perhaps you could read the posting guidelines note (the sticky note at the stop of this forum) and provide us with the additional information.

    Susan

     

View as RSS news feed in XML