Guest User

Untitled

a guest
Jul 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. 100x100 - OK
  2. 100%x100 - OK
  3. 99x99 - OK
  4. 99%x100 - not OK
  5. 99x99% - not OK
  6.  
  7. s = '100%x99%' # this should be failed
  8. match = re.match(r'(100%|d+(?!%))x(100%|d+(?!%))', s)
  9. if match:
  10. x = match.group(1)
  11. y = match.group(2)
  12.  
  13. re.match(r'(100%|d+(?!%))x(100%|d+(?!%))$', s)
  14.  
  15. (100%|d+)x(100%|(d+(?!%|d)))
Add Comment
Please, Sign In to add comment