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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -