-4

I'm looking for a regex javascript expression for allowing only numbers at this format 1234. Not 1,234 or 1.234. I'm having this regex now but it does not seem to work properly /[a-z]/i

user7334203
  • 6,006
  • 20
  • 46
  • 97

1 Answers1

3
var reg = /^\d+$/;

should do it. The original matches anything that consists of exactly one digit.

Feras Al Sous
  • 1,033
  • 1
  • 12
  • 23