Forward
Ensure you're using the latest version of notepad++, there where known problems using regex in notepad++ v5 and before which have been corrected in v6.
Description
- Capture the src attribute value
- works with double quoted, single quoted, and non-quoted attribute values
- avoids tricky edge cases which normally trip up simple expressions
<img(?=\s|>)(?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^\s>]*)*?\ssrc=(['"]?)(.*?)\1(?:\s|>))(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^\s>]*)*>

How To
From Notepad++
press the ctrlF to enter the find and replace
mode
Select the Regular Expression option
Select the ". matches newline" option
In the "Find what" field place the following regex
<img(?=\s|>)(?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^\s>]*)*?\ssrc=(['"]?)(.*?)\1(?:\s|>))(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^\s>]*)*>
Click Find All
Regex Example
Live Demo
Sample Text
Note the first two image tags have some very difficult edge cases
<img onmouseover=' img = 10; src="NotYourImage.png" ; if (3 <img && src="NotYourImage.png" && 6>3) { funRotate(src) ; } ; ' src="ImageYouAreLookingFor.png">
<img onmouseover=' src="NotTheDroidsYouAreLookingFor.png" ; if (x > 3) { funRotate(src); } ' src="http://another.example/picture.png">
<img src="./CaptchaServlet?rd=htb54m" class="flt" id="captcha" height="33" width="110"/>
Matches
Group 0 gets the entire image tag
Group 1 gets the quote used to surround the src attribute, and is used to ensure the correct closing quote is matched
Group 2 gets the src value, or if you use the alternate regex above, will receive just the rd query string
[0][0] = <img onmouseover=' img = 10; src="NotYourImage.png" ; if (3 <img && src="NotYourImage.png" && 6>3) { funRotate(src) ; } ; ' src="ImageYouAreLookingFor.png">
[0][1] = "
[0][2] = ImageYouAreLookingFor.png
[1][0] = <img onmouseover=' src="NotTheDroidsYouAreLookingFor.png" ; if (x > 3) { funRotate(src); } ' src="http://another.example/picture.png">
[1][1] = "
[1][2] = http://another.example/picture.png
[2][0] = <img src="./CaptchaServlet?rd=htb54m" class="flt" id="captcha" height="33" width="110"/>
[2][1] = "
[2][2] = ./CaptchaServlet?rd=htb54m