0

Regex validation of username and password in js

I am trying to use regex to validate username and password I got error see the code below in html and JavaScript https://code.sololearn.com/WwRPuK7ZFuMi/?ref=app

25th Nov 2022, 8:53 PM
Coding
Coding - avatar
3 Réponses
+ 1
The validation function is not defined. Instead of calling the function validation, the onsubmit attribute of the form element should call the CheckPassword function, like so: onsubmit="return CheckPassword()" The CheckPassword function takes in an argument called inputtxt, but it is not being passed in when the function is called in the onsubmit attribute. To fix this, the onsubmit attribute should call the CheckPassword function with the correct input, like so: onsubmit="return CheckPassword(this.password)" The regular expression for the password validation is missing the forward slashes (/) at the beginning and end of the expression. These forward slashes are required to create a regular expression object in JavaScript. The regular expression should be updated to look like this: var password = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20}$/; Coding Try this code https://code.sololearn.com/WVYg4IOexI8g/?ref=app
9th Dec 2022, 3:01 AM
Calviղ
Calviղ - avatar
+ 4
Coding put given username and password inside single or double quotes.
25th Nov 2022, 9:37 PM
A͢J
A͢J - avatar
0
Thanks
9th Dec 2022, 11:19 AM
Coding
Coding - avatar