Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- pattern = re.compile('^.*?((?<!\.[a-z0-9]{8})png|jpg|gif|swf|ico|flv|zip)$')
- # I want the first two to match, but not the second two
- file_list = [
- 'main.ie6.zip',
- 'main.zip',
- 'main.cb1c4aa1.zip',
- 'main.cb1c4aa1.cb1c4aa1.zip'
- ]
- for f in file_list:
- print f
- if pattern.match(f):
- print pattern.match(f).groups()
Add Comment
Please, Sign In to add comment