SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot txt3rob's Avatar
    Join Date
    Jul 2013
    Location
    Liverpool UK
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    capture data between these tags

    I have an array which contains the following

    Code:
    <a href="http://linktoasite" rel="bookmark" title="Permanent Link to linktoasite">something random</a> <img style="border:none;padding:0;position:relative;top:4px" src="online.png">
    how would i strip out just the first link and ignore the rest so it would echo
    Code:
    http://linktoasite

  2. #2
    SitePoint Zealot txt3rob's Avatar
    Join Date
    Jul 2013
    Location
    Liverpool UK
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Solved
    PHP Code:
    $matches null;
    $returnValue preg_match_all('#<a href="(.*?)" rel=#is', <a href="http://linktoasite" rel="bookmark" title="Permanent Link to linktoasite">something random</a> <img style="border:none;padding:0;position:relative;top:4px" src="online.png">
    )
    ', $matches, PREG_PATTERN_ORDER); 


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •