I need your help as I'm stuck on a regular expression.
The regular expression needs to match any characters but the first number. This first number can be an integer, negative, decimal.
so I have the RegExp for that:
var b = /[-]?[0-9]+([\.][0-9]+)?/;
but when I do that in JavaScript:
var a = 'ab123ab45',
b = /[-]?[0-9]+([\.][0-9]+)?/;
a.replace(b, '');
it obviously return: abab45
But what I need, as you may understood, is the other way around. Here are some examples.
123 -> 123
123a -> 123
a123a -> 123
123ab45 -> 123
ab123ab45 -> 123
a1b2c3 -> 1
a1.2b -> 1.2
a1,2b -> 1
And I need to get that using only 1 regular expression with the replace function.