Regex To Match Numbers Containing Only Digits, Commas, and Dots

A regular expression to simply match numbers that contains only digits, commas, and dots. Especially useful in currency validation.

/^[0-9.,]+$/

Matches:

  • 12345.12345
  • 12345
  • 12345,12345

Non-matches:

  • 12345a
  • 12345.a
  • 12345,a

See Also: