The stuff in the curly braces below suggests 1 to 4 places of the number after a decimal if there is a decimal and the asterik any number of a thing.
^[0-9]([0-9])*(\.[0-9]{1,4})?$
This should basically be the same thing I think.
^[0-9]+(\.[0-9]{1,4})?$
I haven't tested this. I really don't know if it works. This is just "note to future self" stuff. I think {4,} would mean four or more.
Addendum 4/16/2017: Someone I just friended on Facebook (Yulia Danilova) suggests: actually, in Regex, question mark means "optional parameter". For instance, colou?r will find a match for both color and colour
No comments:
Post a Comment