php - Matching SRC attribute of IMG tag using preg_match -
I am trying to run Preg_match to remove the SRC attribute in the first IMG tag (in this case , Archived $ line-> Intotext).
preg_match ('/ \ & lt; * [img] [^ \ & gt;] * [src] * = * [\ "\'] {0, 1} ([^ \ "\ '] *) / I', $ line-> exchange, $ match);
ex> & lt; Img src = "Pictures / Stories / OtaQuJua 1.jpg" border = "0" alt = "inside OtaQJoku's store" />
I just get it
0
Reggae should be correct, but I can not tell why it is The border appears to match the attribute and not the src attribute.
Alternatively, if you have patience to read it without lingering directly on the answer field and type 'Use an HTML / XML Parser', a good tutorial can be recommended because I'm having trouble finding PHP which is applicable to PHP 4.
PHP 4.4.7
Try your expression is incorrect:
preg_match ('/ / lt; * img [^ & gt;] * src * = * ["\']? ([^" \ '] *) / I', $ line- & Gt; intertext, $ matches);
Note the removal of brackets around IMG and SRT and some other cleanups.
Comments
Post a Comment