javascript - Jquery RegEx start by plus or minus and numbers only -
i create regular expression allows start plus or minus symbol, followed floating numbers. in order get:
+3 return true; 3 return false; -3. return false; -3.75 return true;
for now, have this: var re = /^[-+]?[0-9]*\.?[0-9]+$/;
. think i'm close, have idea? in advance
it's better use optional group catching decimal part.
^[+-]\d+(?:\.\d+)?$
Comments
Post a Comment