RegEx to validate a string, whether it contains at least one lower case char, upper case char, one digit,one symbol and no whitespace -


possible duplicate:
regex make sure string contains @ least 1 lower case char, upper case char, digit , symbol

what regex make sure given string contains @ least 1 character each of followings ---

  • upper case letter
  • lower case letter
  • no whitespace
  • digit
  • symbol
  • string length >=5 , <=10

how combine these above criteria validate string.

if has regex:

^            # start of string (?=.*[a-z])  # upper case (ascii) letter (?=.*[a-z])  # lower case letter (?=.*\d)     # digit (?=.*[\w_])  # symbol \s           # no whitespace {5,10}       # string length >=5 , <=10 $            # end of string 

or, if regex flavor doesn't support verbose regexes:

^(?=.*[a-z])(?=.*[a-z])(?=.*\d)(?=.*[\w_])\s{5,10}$ 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -