Welcome to WebmasterWorld Guest from 54.227.83.19

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

regex: extract email embedded images

     

camilord

10:06 pm on Oct 16, 2013 (gmt 0)

5+ Year Member



hi.. need some help..

how do i extract the src value using preg_match_all() in a string like...

d asda dsa as <img border=0 width=1024 height=291 id="_x0000_i1025" src="cid:image001.jpg@01CECA91.641305C0">d asda dsa das<br>d asd adsa a <img border=0 width=1024 height=727 id="_x0000_i1026" src="cid:image002.jpg@01CECA91.641305C0">d asdada dasd asd sad d ads ada


thanks for your answer in advance.. :)

lucy24

10:32 am on Oct 17, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



src ?= ?"([^"]+)"

The part in parentheses.

How consistent is the overall pattern? I'm seeing

<img border=0 width=\d+ height=\d+ id="\w+" src="cid:\w+\.jpg@\w+\.\w+">

but don't know how much of that would remain accurate in other cases. Is it always @01CECA91.641305C0 ?

swa66

2:45 pm on Oct 17, 2013 (gmt 0)

WebmasterWorld Senior Member swa66 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



You probably need to address the situation with multiple spaces and/or new lines between the "src" and the "=" (and same of the "=") and you probably need to also avoid it picking up on <script src="javahere.js"> -> so you need to make sure it's inside an <img> tag.
It's all essentially the same technique: you specify what's allow to match, and the part(s) between parentheses determine what you get as "output"
 

Featured Threads

Hot Threads This Week

Hot Threads This Month