You need to use re.search()
instead of re.match()
. The first one is looking to the pattern anywhere in the string, and the other one looks if the pattern can be applied to the string exactly.
From the documentation:
re.search(pattern, string, flags=0)
Scan through string looking for a location where the regular expression pattern produces a match, and return a corresponding match object. Return None
if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the string.
Example:
>>> print(re.search('GOOGLE_MAPS_LATITUDE:\s*(\d+\.\d+)', ll))
<_sre.SRE_Match object at 0xffecf260>
>>> print(re.search('GOOGLE_MAPS_LATITUDE:\s*(\d+\.\d+)', ll).groups())
('25.0463764816',)
>>> print(re.search('GOOGLE_MAPS_LATITUDE:\s*(\d+\.\d+)', ll).group(1))
25.0463764816