Advertisement
zero_shubham1

regex module

Oct 13th, 2015
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. The (?:...) notation should be fairly popular; with it, you can group
  2. parts of a regex, but it does not save them for future retrieval or use. This
  3. comes in handy when you don’t want superfluous matches that are saved
  4. and never used:
  5.  
  6.  
  7. >>> re.findall(r'http://(?:\w+\.)*(\w+\.com)',
  8. ...
  9. 'http://google.com http://www.google.com http://
  10. code.google.com')
  11. ['google.com', 'google.com', 'google.com']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement