SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Help with REGEX (<a> and <img>)

    Hi,,


    i need a regex func to do the following :

    $article is a variable contains normal text ,textual link and image links(<img>)

    ()
    the func should add (http://site.com/) to the <a> tag before the the original link in href ,IF the <a> tag DOESN'T contain <img> tag.

    e.g :
    <a> with <img>:
    HTML Code:
    <a href="http://google.com/" target="_blank"><img src="http://google.com/logo.png" /></a>

    textual <a> without <img>:
    HTML Code:
    <a href="http://google.com/" target="_blank">normal text</a>

    please help .!

  2. #2
    SitePoint Member
    Join Date
    Jun 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bottom line :

    parse $article , if the <a> tag contains <img> then DO NOT add (http://site.com/) before the the original link in href.

    else , if the <a> DOES NOT contains <img> then add (http://site.com/) before the the original link in href.


Tags for this Thread

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
  •