Oracle APEX POSIX-implementation REGEX for Password Validation -


i've read 20+ different flavors of same question on past 4 hours no positive results.

i'm trying validate password via regex in oracle apex app understanding uses posix implementation of regex apparently more "strict" engine versions of regex??? (i have not yet been able verify specifically, testing lead me believe true)

ultimately need validate password that:

  • is between 14 , 18 characters long
  • has @ least 1 lower case character
  • has @ least 1 upper case character
  • has @ least 1 digit
  • has @ least 1 of following special characters #$^+=!*()@%&

i have tried several regex expressions in simple form not work in apex implementation.

for example:

^\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[a-z])\w*$ 

in theory should accept input string long has atleast 1 digit, 1 upper case, , 1 lower case character.

using javascript regexp: regular expression tester entering "ws1". returns string match.

if use same regexp regular expression validator , enter "ws1" field validation fails.

is there i'm missing in particular implementation of regex need aware of?

edit

i've ultimatley abandoned regex due apex's extensive options validation.

it has built in ability "item in [expression1] must contain atleast 1 of characters listed in [expression2]". unfortunately requires me write multiple validations (i'm 6 right now).

on bright side allows me display multiple error messages , user updates new password error messages removed user fulfills requirement....

all in all, still feels hack me, , i'm still interested in knowing secret behind regexp.

this regex should work you:

^(?=.*[a-z])(?=.*[a-z])(?=.*\d)(?=.*[#$^+=!*()@%&]).{14,18}$ 

explanation:

^                     #the start of string. (?=.*[a-z])           #any chars , lowercase. (?=.*[a-z])           #any chars , uppercase. (?=.*\d)              #any chars , digit. (?=.*[#$^+=!*()@%&])  #any chars , char list. .{14,18}              #after matching each of previous, match 14 18 of char. $                     #the end of string. 

the (?=) lookaround group verifies match can made, doesn't capture anything. i.e. after success goes previous position in string...in case ^ beginning.


Comments