Guest User

Untitled

a guest
May 27th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. import re
  2. pattern = re.compile('^.*?((?<!\.[a-z0-9]{8})png|jpg|gif|swf|ico|flv|zip)$')
  3. # I want the first two to match, but not the second two
  4. file_list = [
  5. 'main.ie6.zip',
  6. 'main.zip',
  7. 'main.cb1c4aa1.zip',
  8. 'main.cb1c4aa1.cb1c4aa1.zip'
  9. ]
  10.  
  11. for f in file_list:
  12. print f
  13. if pattern.match(f):
  14. print pattern.match(f).groups()
Add Comment
Please, Sign In to add comment