#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    Get specific img tag


    Hi to all,
    I want to congratulate with you because I follow your interesting forum as non registered user and I can find a very usefull advice! Now I need your help with a regular expression.
    I have this html code:

    Code:
    <p>Dfdfdsa</p> <p>Addasads</p> <p>Dasasdsadsa.</p> <p><img class="cntr" id="3" src="http://local.megalab.it/mli2/htdocs/images/contents/3/normal.png" mce_src="3/normal.png"><h2>ddsdfsdfdfs</h2></p><p>dfdsfdsfdds</p><p><h2>fdadffdfddf</h2></p><p>dfdfdfsdfdfdfsfds</p><p><img src="spacer.gif" mce_src="spacer.gif" class="mceItemFlash" title="PG9iamVjdCB3aWR0aD0iNDI1IiBoZWlnaHQ9IjM0NCI+PHBhcmFtIG5hbWU9Im1" id="68730706" alt="68730706" height="344" width="425"><br></p>
    and I'm using this regexp
    Code:
    <img(.*?)alt="68730706"(.*?)>
    With it, I grab the first and the second img tag with p tag and all the text between them, but my target is grab only this portion of HTML:

    Code:
    <img src="spacer.gif" mce_src="spacer.gif" class="mceItemFlash" title="PG9iamVjdCB3aWR0aD0iNDI1IiBoZWlnaHQ9IjM0NCI+PHBhcmFtIG5hbWU9Im1" id="68730706" alt="68730706" height="344" width="425">
    Could you help me to find the right regular expression??

    Thank you very much for your help!!
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,241
    Rep Power
    9400
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0
    Thank you very much!
    It works perfectly!

IMN logo majestic logo threadwatch logo seochat tools logo