can you explain me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

can you explain me

can u explain me function CheckPassword(txt) { var passw= /^[A-Za-z]\w{7,14}$/; // just explain me this line if(txt.value.match(passw)) { alert('Correct, try another...') return true; } else { alert('Wrong...!') return false; } } /^[A-Za-z]\w{7,14}$/ some how i get it that any lowercase and any uppercase but after that why \w{7,14}$/ please anyone can explain me

1st Oct 2017, 11:39 PM
Susovan Das
Susovan Das - avatar
2 Answers
+ 8
^ stand for start of string [A-Za-z] stand for one occurence of any of char range \w stand for word char (ie: any alphanumeric char, including underline char) {7,14} specify than previous \w need to be found between 7 and 14 times $ stand for end of string (in some context, also mark new line)
2nd Oct 2017, 12:21 AM
visph
visph - avatar
+ 2
Hi, that is to validate the length of password is between 7 to 14 characters
1st Oct 2017, 11:54 PM
Khun Ling Tan
Khun Ling Tan - avatar