Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vwedesam/03951aa3f08057e2b94892d231998d9e to your computer and use it in GitHub Desktop.
Save vwedesam/03951aa3f08057e2b94892d231998d9e to your computer and use it in GitHub Desktop.
PostgreSQL Regex match numeric(interger and demical)

The problem here is the two 0 or more [0-9] elements on each side of the decimal point.

we need to use a logical OR | in the number identification line:

E.g

  0.00434, 0.233220, 4.909, 0.0000003333

Solution

 amount ~ '^([0-9]+\.?[0-9]*|\.[0-9]+)$'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment