I've probably read 20+ different flavors of this same question over the past 4 hours with no positive results.
I'm trying to validate a password via regex in an Oracle APEX app which to my understanding uses a POSIX Implementation of regex which is apparently a more "strict" engine than most versions of regex??? (I have not yet been able to verify this specifically, but my testing would lead me to believe that it is true)
Ultimately I need to validate a password that:
- Is between 14 and 18 characters long
- Has at least 1 lower case character
- Has at least 1 upper case character
- Has at least 1 digit
- Has at least 1 of the following special characters #$^+=!*()@%&
I have tried several regex expressions which even in their most simple form do not work in the Apex implementation.
For example:
^\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*$
In theory should accept any input string as long as it has atleast 1 digit, 1 upper case, and 1 lower case character.
Using Javascript RegExp: Regular Expression Tester by simply entering "wS1". It returns the string as a match.
If I use the same RegExp for as a Regular Expression Validator and enter "wS1" into the field the validation fails.
Is there something I'm missing in this particular implementation of regex that I need to be aware of?
EDIT
I've ultimatley abandoned the regex for now due to Apex's extensive options for validation.
It has the built in ability to say something like "Item in [expression1] must contain atleast one of the characters listed in [expression2]". Unfortunately it requires me to write multiple validations (I'm up to 6 right now).
On the bright side it allows me to display multiple error messages and as the user updates their new password the error messages are removed as the user fulfills the requirement....
All in all, It still feels like a hack to me, and I'm still interested in knowing the secret behind the regexp.