I created a regex to parse two floating point numbers and a *
symbol between them using Python. As I am completely new to both I've tried basic online guides on using re
library and regex itself. I came up with ((\d+)?(\.?)\d+)\*((\d+)?(\.?)\d+)
which works fine here even for the string in question, 2+21.0*2*2
.
But if I use this expression and string in Python like so
m = re.match(r"((\d+)?(\.?)\d+)\*((\d+)?(\.?)\d+)", "2+21.0*2*2")
it gives me "None" object. I do not see any obvious problems, any ideas why it does not work?