From Richie, 1 Year ago, written in Python.
This paste is a reply to Re: Regex URL Grabber from Richie
- view diff
Embed
  1. ##### WHAT I TRY TO DO #####
  2.  
  3. I want to find URLs in text files. In the input string can be no, one, or multiple URLs.
  4.  
  5.  
  6. ##### CODE #####
  7.  
  8. regex = "([A-Za-z]{3,10}:\/\/){1}"
  9. regex_compiled = re.compile(regex, re.IGNORECASE)
  10.  
  11. test = "sadojasdo http://blar.com https://bsakdnbajs.com saodj/html.html https://a.b.abc/bla.jpg"
  12. print("Regex: '"+regex+"'")
  13. print("Test String: '"+test+"'")
  14. print("Expected Result: '[\"http://blar.com\",\"https://bsakdnbajs.com\",\"https://a.b.abc/bla.jpg\"]'")
  15. print("Result:" + str(regex_compiled.findall(test)))
  16.  
  17. ##### PROGRAM OUTPUT #####
  18.  
  19. Regex: '([A-Za-z]{3,10}:\/\/){1}'
  20. Test String: 'sadojasdo http://blar.com https://bsakdnbajs.com saodj/html.html https://a.b.abc/bla.jpg'
  21. Expected Result: '["http://blar.com","https://bsakdnbajs.com","https://a.b.abc/bla.jpg"]'
  22. Result:['http://', 'https://', 'https://']
  23.  

Replies to Re: Re: Regex URL Grabber rss

Title Name Language When
Re: Re: Re: Regex URL Grabber Richie python 1 Year ago.
captcha