Hi all
I'm trying to write a regex expression to match the src, width and height attributes on an image tag. The width and height are optional.
I have came up with the following:
(?:<img.*)(?<=src=")(?<src>([\w\s://?=&.]*)?)?(?:.*)(?<height>(?<=height=")\d*)?(?:.*)(?<width>(?<=width=")(\d*)?)?
expresso shows this matching only the src bit for the following html snippet
<img src="myimage.jpg" height="20" />
<img src="anotherImage.gif" width="30"/>
I'm hoping I'm really close and someone here can point out what I'm doing wrong, I have a feeling its my optional in between characters bit (?:.*) i've tried making it non greedy to no success. So any pointers?