Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string1 = '%(example_1).40s-a%(example-2)s_-%(example3)s_s1'
- '-a', '_-', '_s1'
- re.findall("[-_a-z0-9]+(?![^%]*s)", string1)
- ['example_1', '0s-a', 'example-', 's_-', 'example', 's_s1']
- re.findall("[-_a-z0-9]+(?![^(]*))", string1)
- ['40s-a', 's_-', 's_s1']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement