Mega Code Archive

 
Categories / Python Tutorial / Regular Expressions
 

Matching Strings with match()

import re m = re.match('foo', 'foo')    # pattern matches string if m is not None:         # show match if successful      m.group()