0

I want to validate a string using in bootstrapvalidator. String must contain

Minimum of 6 characters.

maximum 12 characters

Must contains atleast one numeral.

Must contain atleast one capital letter.

Must contain atleast one special characters

How can I do that? Can anyone show me the regular expression to do that?

I am already have this:

regexp:
       {
         regexp: "^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])[A-Za-z\d$@$!%*?&]{6,12}",

        message: 'The password should contain Minimum 6 and Maximum 12 characters at least 1 Uppercase Alphabet, 1 Lowercase Alphabet, 1 Number and 1 Special Character:'
       }

But if i enter correct password requirements also it is showing redcolor and it is not changing to green color

GoBusto
  • 4,632
  • 6
  • 28
  • 45
vinay
  • 25
  • 2
  • 8
  • Which programming language are you using? Also, the [tag:bootstrap] tag is for *"a series of procedures run when an application starts up or a request over the web is received."*, so I don't think that it's the tag you want. – GoBusto Apr 17 '15 at 08:04

1 Answers1

1
/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[$@!%?&]).{6,12}$/

Please check this thread for more information! Try to search the website for a solution before posting a question.

Community
  • 1
  • 1
Docteur
  • 1,235
  • 18
  • 34
  • i checked before posting question but it is not workinjg with bootstrapvalidator – vinay Apr 17 '15 at 08:28
  • Try `/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[$@!%?&]).{6,12}$/` ? – Docteur Apr 17 '15 at 08:30
  • Hm.. Strange? It should. I tested it on Java and Javascript, and they work the same way than the Bootstrapvalidator. Are you sure that the **code** around leading to the validation works? – Docteur Apr 17 '15 at 08:41
  • Now it is working. the problem is i put regex within quotes. now i fixed the bug. it is working fine. thank you – vinay Apr 17 '15 at 08:44