Advertisement
jxsl13

regex python example

Aug 21st, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.18 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import re
  4.  
  5. s = "it ends-in-ing wow"
  6.  
  7. match = re.search(r"[\s]+([\w\-]+)[\s]+", s)
  8.  
  9. if match:
  10.     print(match.group(1))
  11. else:
  12.     print("Nothing found.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement