Hi guys,
I'm not too familiar with regular expressions and I've been having a hard time building an expression that will do what I want. Basically, what I need is a regular expression which will parse out all IMG tags found in a string. In addition, I need easy access (match groups) for the following attributes: src, height, width, alt.
Here are some examples of img tags that this regular expression should properly parse:
<img src="/images/image1.jpg" alt="Test Image" height="2" width="1" />
<img src='/images/image1.jpg' alt='Test Image' height='2' width='1' />
<img src='/images/image1.jpg' alt="Test Image" height='2' width="1" />
<img height="2" width="1" src="/images/image1.jpg" alt="Test Image" />
<img height='2' width='1' src="/images/image1.jpg" alt="Test Image" />
<img height='2' width="1" src='/images/image1.jpg' alt="Test Image" />
It's important that this expression parse the attributes no matter which order they are in, and if they are marked using ' or ".
Would anybody be so kind to help me put this expression together properly?
Thank you so much for your time and efforts.