Guest User

Untitled

a guest
Aug 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. Regular Expression to accept only positive numbers and decimals
  2. /^[-]?[0-9]+[.]?[0-9]+$/;
  3.  
  4. /^[+]?([0-9]+(?:[.][0-9]*)?|.[0-9]+)$/
  5.  
  6. 0
  7. +0
  8. 1.
  9. 1.5
  10. .5
  11.  
  12. .
  13. 1..5
  14. 1.2.3
  15. -1
  16.  
  17. /^[+]?([0-9]+(?:[.][0-9]*)?|.[0-9]+)(?:[eE][+-][0-9]+)?$/
  18.  
  19. /^[+]?([1-9][0-9]*(?:[.][0-9]*)?|0*.0*[1-9][0-9]*)(?:[eE][+-][0-9]+)?$/
  20.  
  21. ^[.]?[0-9]+[.]?[0-9]*$
Add Comment
Please, Sign In to add comment