I have a requirement where in a user input the regular expression should match only numbers either digits or numbers with decimal points, however if there is a number followed with a percentage symbol then that should be excluded, but numbers followed with alphabets like 100g or 500 grams should be matched without picking up the alphabet part
I have come up with the following:
let numberPart = importValue.match(/d+(?:[.,]d+)?b(?!(?:[.,]d+)|(?:s?%|spercent))/g);
11 grams nutella 1,5% is matched and we get 11 as output
however 11grams nutella 1,5% isn’t matched
how can I change it so it matches numbers followed immediately by an alphabet or alphabets.