Password verification test

I’m trying to trying to verify that a users password meets certain criteria, i.e. it contains both letters and numbers. I’m using the below code and then passing the password to Wix CRM. However if the user inputs “+” as part of their chosen password Wix it will not allow them to register.

Does anyone know how to allow the “+” symbol to be entered as part of their password ?

//declare function to enforce letter in password

var letters = /^(?=.*[a-zA-Z]).+$/;

//declare function to enforce number in password

var number = /^(?=.*[0-9_\W]).+$/;

if ((letters.test($w(‘#SignupPasswordInput’).value)) &&
(number.test($w(‘#SignupPasswordInput’).value)))
{

wixUsers.register($w(‘#SignupEmailInput’).value, $w(‘#SignupPasswordInput’).value, {
“contactInfo”: {
“firstName”: $w(‘#SignupFirstNameInput’).value,
“lastName”: $w(‘#SignupLastNameInput’).value,

} 

})

Hi Mike: I think you might need to review the JavaScript regular expression documentation.

You probably don’t need both the text and the number regular expression. Additionally I think including \W will cancel out 0-9 in the test [0-9_\W].

thanks Steve, got it sorted now