I am working on input sanitation and want to write the regular expression for password validation. I was using OWASP ESAPI for the validation of the input parameters but I cant do that since regex provided for password validation by ESAPI is not satisfying all the conditions.
such as
• 8-20 characters using letters and numbers
• Cannot have 3 or more consecutive identical letters, numbers, or special characters
• Cannot contain a space
Optional:
• One or more special characters, except for “ & ’ ⁄ < > [ \ ] { | } ~ ^ !
• Case sensitive
PWASP ESAPI regex -![CDATA[^(?:(?=.*\d)(?=.*[A-Z])(?=.*[a-z])|(?=.*\d)(?=.*[^A-Za-z0-9])(?=.*[a-z])|(?=.*[^A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z])|(?=.*\d)(?=.*[A-Z])(?=.*[^A-Za-z0-9]))(?!.*(.)\1{2,})[A-Za-z0-9!~<>,;:_=?*+#."&§%°()\|\[\]\-\$\^\@\/]{8,32}$]]
I tried to modify it but i was not getting expected results as well as i am not super confidant with regex as i never used them before. How can i create a regex that can incorporate all the conditions?
Thank you