-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

RamAlx
  • 6,976
  • 23
  • 58
  • 106

1 Answers1

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

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

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