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 122 times
-4
user7334203
- 6,006
- 20
- 46
- 97
-
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,033
- 1
- 12
- 23