I'm testing this in IPython. The variable t
is being set from text in a dictionary and returns:
u'http://www.amazon.com/dp/B003T0G9GM/ref=wl_it_dp_v_nS_ttl/177-5611794-0982247?_encoding=UTF8&colid=SBGZJRGMR8TA&coliid=I205LCXDIRSLL3'
using this code:
r = r'amazon\.com/dp/(\w{10})'
m = re.findall(r,t)
matches correctly and m
returns [u'B003T0G9GM']
Using this code,
p = re.compile(r)
m = p.match(t)
m
returns None
This appears correct to me after reading this documentation. https://docs.python.org/2/howto/regex.html#grouping
I also tested here to verify the regex before trying this in IPython http://regex101.com/r/gG8eQ2/1
What am I missing?