0

I have an input field and i want that no user can input any numeric digits in the field...how would i do it.?the input field should not take any special characters also except ampersand(&),and can accept spaces.

1
  • what you have tried ? Have u searched Regex on Google ? Commented Jan 30, 2014 at 6:06

2 Answers 2

1

Use a character class with beginning and end anchors to specify what is allowed:

/^[a-z& ]*$/i

Allows:

  • A-Z (case insensitive)
  • & (ampersand)
  • spaces

0 or more times.

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

Comments

0

This checks that there are no numbers in the string:

/[^0-9]*/

1 Comment

I just want to note remus answer is correct. I'm just showing the general way to accept with just no numbers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.