Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Regular Expression to accept only positive numbers and decimals
- /^[-]?[0-9]+[.]?[0-9]+$/;
- /^[+]?([0-9]+(?:[.][0-9]*)?|.[0-9]+)$/
- 0
- +0
- 1.
- 1.5
- .5
- .
- 1..5
- 1.2.3
- -1
- /^[+]?([0-9]+(?:[.][0-9]*)?|.[0-9]+)(?:[eE][+-][0-9]+)?$/
- /^[+]?([1-9][0-9]*(?:[.][0-9]*)?|0*.0*[1-9][0-9]*)(?:[eE][+-][0-9]+)?$/
- ^[.]?[0-9]+[.]?[0-9]*$
Add Comment
Please, Sign In to add comment