0

i want a regular expression that contains alpha and numeric characters and must be at least 8 characters.all can be alpha or numeric.my expression is

^[a-zA-Z0-9]*$

kindly correct it it is not taking 8 characters and i m using it first time

Rania Umair
  • 1,965
  • 3
  • 18
  • 18
  • Hope below link may help you http://stackoverflow.com/questions/336210/regular-expression-for-alphanumeric-and-underscores – vpv Apr 09 '12 at 06:37
  • possible duplicate of [Regex for minimun number of characters](http://stackoverflow.com/questions/9915702/regex-for-minimun-number-of-characters) – slugster Apr 09 '12 at 06:43
  • [other possible duplicates](http://stackoverflow.com/search?q=[regex]+minimum+characters) – slugster Apr 09 '12 at 06:43

1 Answers1

2

You can use:

^[a-zA-Z0-9]{8,}$
codaddict
  • 445,704
  • 82
  • 492
  • 529
  • With which regex implementation? Some don't support the brace syntax; some require escapes (that is, `\{8,\}`). (This question really for @Rania) – geekosaur Apr 09 '12 at 06:28
  • @Rania - post some actual code. The regex supplied in this answer should work, so you are probably doing something else wrong. At the moment people can only guess what the problem is - try and make our job a little easier if you want help. – slugster Apr 09 '12 at 06:41