-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

1
  • Sorry, but what does /[a-z]/i regex has to do with numbers? What was your intent? How did you use it? Commented Jun 14, 2017 at 6:09

1 Answer 1

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

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.