• I will be dealing with a big string that contains various html elements with attributes.

    My ultimate goal is to get src=”pictureaddress” out of the <img> elements the big string contains,
    and then add the contents of the src=”” (an image address) to the database.

    The string might contain any html element/tag, and quite some random characters.

    for example the big string could be:

    <img class="alignnone size-medium wp-image-71" title="5bwallcoo_com5d_photobook_horikitam1" src="https://localhost/wordpress/wp-content/uploads/2008/09/5bwallcoo_com5d_photobook_horikitam1-300x225.jpg" alt="" width="300" height="225" /><img class="alignnone size-medium wp-image-73" title="normal_maki-horikita-0098-92784" src="https://localhost/wordpress/wp-content/uploads/2008/09/normal_maki-horikita-0098-92784-300x225.jpg" alt="" width="300" height="225" />
    [caption id="attachment_72" align="alignnone" width="265" caption="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"]<img class="size-medium wp-image-72" title="maki" src="https://localhost/wordpress/wp-content/uploads/2008/09/maki-265x300.jpg" alt="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" width="265" height="300" /><img class="alignnone size-medium wp-image-70" title="4f04e9a0102900_full1" src="https://localhost/wordpress/wp-content/uploads/2008/09/4f04e9a0102900_full1-300x225.jpg" alt="" width="300" height="225" />

    So our goal is to get these bad boys out, using some sort of for loop, and adding each one to the database each time.

    Thank you very much.
    Nicholas Reed
    nicholasreed.net

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘String manipulation’ is closed to new replies.