I need help with constructing a regular expression that finds the src of image tags. I use .net.
I have all the html in a string and what I need to match is this:
<img src="xxxx">
Some of the image tags can look like this:
<img class="s" src="xxxx">
or:
<img xmlns:i18n="http://apache.org/cocoon/i18n/2.1" src="xxx">
Any regexp gurus out there?
/Magnus
Need to find the <img src tags
Moderator: General Moderators
- Skittlewidth
- Forum Contributor
- Posts: 389
- Joined: Wed Nov 06, 2002 9:18 am
- Location: Kent, UK
This post might help you get started:
viewtopic.php?p=79152&highlight=#79152
Redmonkey gives a good regex halfway down that won't catch the src of <script> tags unlike my final soluction (I knew there wouldn't be scripts on the page I was running it on.)
You will possibly need to adapt this a bit for xml though.
viewtopic.php?p=79152&highlight=#79152
Redmonkey gives a good regex halfway down that won't catch the src of <script> tags unlike my final soluction (I knew there wouldn't be scripts on the page I was running it on.)
You will possibly need to adapt this a bit for xml though.