We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

How to do a regex that allow only: numbers, alphabetic, spaces and comma(,) for javascript?

MrFahad
MrFahad asked
on
Medium Priority
887 Views
Last Modified: 2012-05-06
How to do a regex that allow only: numbers, alphabetic, spaces and comma(,) for javascript?
Comment
Watch Question

CERTIFIED EXPERT
Commented:
1 or more times:
/^[\da-z ,]+$/i
0 or more times:
/^[\da-z ,]*$/ig;

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
hmm what you mean by 1 or more times and 0 or more times thank you :)
CERTIFIED EXPERT

Commented:
Do you want to allow empty input?  If so, use the 0 pattern, if not, use the 1 pattern.

Author

Commented:
very fast reply less than 1min i swear i almost thought that this an auto reply lol :p
great job
CERTIFIED EXPERT

Commented:
Thanks for the question and the points.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.