Hi, this works now, but I'm confused about why.
I am learning a regex and need to infer numbers from strings, e.g.
'Discount 7.5%' should get 7.5
'Discount 15%' should get 15
'Discount 10%' should get 10
'Discount 5%' should get 5
and etc.
/\d,?.\d?/
/\d,?.\d,?/
/\d?.\d?/
I thought that one of the second two will work, can someone explain this.
source
share