Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bhttps?:[^)''"]+.(?:jpg|jpeg|gif|png)
- <cfset variables.getImageURLs = reMatch('bhttps?:[^)''"]+.(?:jpg|jpeg|gif|png)', variables.getDocument) />
- <img src="/local/images/get_profile_pic.php?id=12345" title="John Doe" />
- <imgs+[^>]*?src=("|')([^"']+)1
- <cfset html = variables.getDocument /> <!--- your HTML --->
- <cfset pattern = CreateObject("java","java.util.regex.Pattern").compile('(?i)<imgs+[^>]*?src=("|')([^"']+)1') />
- <cfset matcher = pattern.matcher(html) />
- <!--- loop through the matches --->
- <cfloop condition="matcher.find()">
- <cfset src = matcher.group(2) />
- </cfloop>
- <img - Literal string "<img", match the opening tag
- s+ - Match one or more whitespace characters, so <imgt is valid
- [^>]*? - Lazily match any character that is not a '>' while looking for the next literal string
- src= - Literal string "src="
- ("|') - Match either a single or a double quote, both are valid in HTML
- ([^"']+) - Match anything that isn't a single or double quote. Note: You *could* use [^1] here, however this way the match will reject malformed HTML attributes that have mismatched quotes
- 1 - Match the value of the first group (either a single or double quote)
- bhttps?:[^)''"]+.(?:jpg|jpeg|gif|png)(?![a-z/])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement