Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. string1 = '%(example_1).40s-a%(example-2)s_-%(example3)s_s1'
  2.  
  3. '-a', '_-', '_s1'
  4.  
  5. re.findall("[-_a-z0-9]+(?![^%]*s)", string1)
  6.  
  7. ['example_1', '0s-a', 'example-', 's_-', 'example', 's_s1']
  8.  
  9. re.findall("[-_a-z0-9]+(?![^(]*))", string1)
  10.  
  11. ['40s-a', 's_-', 's_s1']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement