How to set a limit to the amount of capitalized characters?

Hello everyone,   Sometimes when I create accounts, I get the error that there are no non-capitalized characters in my password, which is required. I have set my security to include both capitalized and non-capitalized.   At the moment my expression for ‘NrOfCapitalizedCharacters’ is  ‘1’. I Believe this only sets it to a minimum and not a maximum, and I cant seem to find how to set a maximum.   I am using the Java action ‘Random Strong Password’.   Thanks in advance.    
4 answers

You are talking both about creating your own password and about setting password-requirements for users that are logging in to your app.

For Creating your own there is this regex: that modified to your wish (set to max 8 uppercase characters)would probably be


For an extra check on the user’s password, I don’t think you can adjust that.


Hi Koen,


ran some tests. It seems you're correct. When the “minimum amount of characters” is higher then the given amount of "NrOfCapitalizedCharacters + NrOfDigits +NrOfSpecialCharacters” the action will just and more of these in combination with lowercase symbols.

Also the “max amount of characters” is often neglected bij the action.


As far as I can see there is no maximum amount of characters to be set. You will have to adjust the java action for that / write your own. 

You could validate the password with a regular expression, if it fails, generate a new password.


Roy's workaround to validate generated random passwords and create a new password if needed works, but..


It would be great if the CommunityCommons module will be updated to be able to generate Random passwords that match the security setting “Require mixed case [This requires the password to contain both lowercase and uppercase characters]”. Maybe by adding a parameter like noOfLCAlpha to be able to specify a minimum amount of lowercase characters too?

There is already a github issue for a similar request (since feb '21):


I would suggest that u can create ur own password generator java action with some required parameters

Java Password Generator - Javatpoint

drop me a line at in case u need help