Hi this is working now but I am confused at to why.
I am learning regex and need to pull the numbers out of strings like
'Discount 7.5%' should get 7.5 'Discount 15%' should get 15 'Discount 10%' should get 10 'Discount 5%' should get 5 etc.
/\d,?.\d?/ //works /\d,?.\d,?/ //doesn't works /\d?.\d?/ //doesn't works I thought one of the second two would work could someone explain this.
.in all three regex by preceding it with \, 2. Use\d+to match more than one digits 3. No need of,in any regex(\d+(\.\d+)?)with first capture group