Skip to content

Instantly share code, notes, and snippets.

@mayjs
Created November 17, 2014 22:57
Show Gist options
  • Save mayjs/124010ec649dbe7265e0 to your computer and use it in GitHub Desktop.
Save mayjs/124010ec649dbe7265e0 to your computer and use it in GitHub Desktop.
Useful regular expressions
\d+ Checks for positive (unsigned) integers
-?\d+ Checks for positive and negative (signed and unsigned) integers
-\d+ Checks for negative (signed) integers
-?\d*(\.\d+)? Checks for positive and negative decimals.
-?\d*(\.\d{n})? Checks for positive and negative decimals with precision n.
-?\d*(\.\d{n,m})? Checks for positive and negative decimals with a precision between n and m
-?\d*(\.\d{n,})? Checks for positive and negative decimals with a precision greater then or equal to n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment