I use this to extract the src of the image or the full path of image.
preg_match_all('/\< *[img][^\>]*src *= *[\"\']{0,1}([^\"\'\ >]*)/',$content,$matches);
It works for me so far, I get an array of all images sources. I am trying to be greedy and capture the alt and title values from the image tags.
I know it is not recommended to use regex to do it, but I really need a quick solution. I do not want it to return an error if alt or title is missing from the image tag.
Any input is appreciated and apologies. I know it is easier and appropriate with parser, but since I could get the src with that preg match i thought i could get the alt and title too! :)
Thanks a lot, happy new year :D