Home > Regular Expressions > Regular Expressions: Only numbers, letters, spaces and restricted string length

Regular Expressions: Only numbers, letters, spaces and restricted string length

21:27

Marek Śliwiński Leave a comment Print This Post  (195) Go to comments

Only numbers, capital, small letters (English) and spaces are allowed. String length must be between 1 to 10 characters.

Regex:

^[A-Za-z0-9 ]{1,10}$

If you would like to add some chars for example: ,.- then just add them like that:

Regex:

^[A-Za-z0-9 ,.-]{1,10}$
Share and Enjoy:
  • DotNetKicks
  • Digg
  • del.icio.us
  • Wikio IT
  • Google Bookmarks
  • Facebook
  • Print
  1. No comments yet.
  1. No trackbacks yet.

Subscribe without commenting