regex - a decimal without an integer part -
i use following expression match decimal number
\d+[.,]?\d+ i trying make digits before decimal separator optional, thought following should do
\d+?[.,]?\d+ but did not, can 1 please explain why?
as trying make match of following examples
44 44.44 44,44 .44 ,44
i trying make digits before decimal separator optiona
just use * quantifier first \d , set ? quantifier character class:
\d*[.,]?\d+ see regex demo
the reason expression not work \d+? requires @ least 1 digit match.
Comments
Post a Comment