Using a rest api I get the following forms of strings back:
/primerjs-0.0.3-3.tgz
/primerjs-0.0.3.tgz
/0.0.3-16
I want to grab just the 0.0.3 part from the above strings. I came up with the following regex expression:
(\d+\.)+\d*(?!tgz)
and I have tested it on an online regex tester and it seems to grab what I want it to. However the following code only prints ['0.']
text = '/primerjs-0.0.9.tgz'
m = re.findall(r"(\d+\.)+\d*(?!tgz)", text)
print m
what am I doing wrong?