+ Start a Discussion
bharathvbharathv 

Password should contain mixed of numeric,alphanumeric and special charaters

Hi,

Can any one help me how to validate password should contain atleast one numeric, 1 alpha numeric and 1 special charaters

 

Thanks & Regards,

Bharath

mrajmraj

Hi,

 

u can use the following validation rule,

 

NOT(REGEX( FIELD_TO_BE_VALIDATED  , "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})"))

 

This will check for one numeric character, one upper case , one lower case and @, #, $,% special characters.

It will also check ur password length having minimum of 6 and maximum of 20 characters.

 

bharathvbharathv

Hi,

 

it is giving below error

 

Error: java.util.regex.PatternSyntaxException: Unclosed counted closure near index 48 ((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})

mrajmraj

u need to escape \d witth \\d as i have provided in the above regex. Please rectify your formula..

bharathvbharathv

still its giving syntax error eventhough i corrected to

 

"((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})"

 

 

mrajmraj

i can see error in your REGEX . Please copy and  paste the below given validation rule in your Error Condition Formula block.

 

NOT(REGEX( password__c , "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})"))

 


Replace password__c in above formula with the field which you want to validate.

Abc234Abc234

i have pasted the same code but getting

 

Error: java.util.regex.PatternSyntaxException: Unclosed counted closure near index 48 ((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})