I have extracted a string value from my sql table and it is like below:
<p>Commodity Exchange on 5 April 2016 settled as following graph:</p>
<p><img alt=\"\" src=\"ckeditor/plugins/imageuploader/uploads/986dfdea.png\"
style=\"height:163px; width:650px\" /></p></p>
<p>end of string</p>
I wish to get image name 986dfdea.png inside the html tag (because there's a lot of <p></p>
tags inside the string, and I want to able to know that this tag contains image), and replace the whole tag content by a symbol, like '#image1'.
Eventually it would become this:
<p>Commodity Exchange on 5 April 2016 settled as following graph:</p>
#image1
<p>end of string</p>
I'm developing API for mobile apps, but having baby skill on PHP, still can't achieve my goal by referring to these references:
PHP/regex: How to get the string value of HTML tag?
How to extract img src, title and alt from html using php?
Please help.
![\"\"]()
` for `#image1` , right ? is there really `` or just one ? – Pedro Lobito May 13 '16 at 15:25