Regular Expression Matching
Matching within strings
- Syntax: math_object = re.search(string)
- E.g.
>>> regex = re.compile('11*')
>>> match = regex.match("I have $111 dollars")
>>> print match
None
>>> match = regex.search("I have $111 dollars")
>>> print match
<_sre.SRE_Match object at 0x00A036F0>
>>> match.group()
'111'