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
Asked
Active
Viewed 143 times
-4

RamAlx
- 6,976
- 23
- 58
- 106
-
Sorry, but what does `/[a-z]/i` regex has to do with numbers? What was your intent? How did you use it? – Wiktor Stribiżew Jun 14 '17 at 06:09
1 Answers
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