Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. bhttps?:[^)''"]+.(?:jpg|jpeg|gif|png)
  2.  
  3. <cfset variables.getImageURLs = reMatch('bhttps?:[^)''"]+.(?:jpg|jpeg|gif|png)', variables.getDocument) />
  4.  
  5. <img src="/local/images/get_profile_pic.php?id=12345" title="John Doe" />
  6.  
  7. <imgs+[^>]*?src=("|')([^"']+)1
  8.  
  9. <cfset html = variables.getDocument /> <!--- your HTML --->
  10. <cfset pattern = CreateObject("java","java.util.regex.Pattern").compile('(?i)<imgs+[^>]*?src=("|')([^"']+)1') />
  11. <cfset matcher = pattern.matcher(html) />
  12.  
  13. <!--- loop through the matches --->
  14. <cfloop condition="matcher.find()">
  15. <cfset src = matcher.group(2) />
  16. </cfloop>
  17.  
  18. <img - Literal string "<img", match the opening tag
  19. s+ - Match one or more whitespace characters, so <imgt is valid
  20. [^>]*? - Lazily match any character that is not a '>' while looking for the next literal string
  21. src= - Literal string "src="
  22. ("|') - Match either a single or a double quote, both are valid in HTML
  23. ([^"']+) - 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
  24. 1 - Match the value of the first group (either a single or double quote)
  25.  
  26. bhttps?:[^)''"]+.(?:jpg|jpeg|gif|png)(?![a-z/])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement