1var regularExpression = /^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,16}$/;
2
1function checkPassword(str)
2{
3 var re = /^(?=.*\d)(?=.*[!@#$%^&*])(?=.*[a-z])(?=.*[A-Z]).{8,}$/;
4 return re.test(str);
5}
6
1analyze(event) {
2 if(strongRegex.test(event.target.value)) {
3 this.setState({ backgroundColor: "#0F9D58" });
4 } else if(mediumRegex.test(event.target.value)) {
5 this.setState({ backgroundColor: "#F4B400" });
6 } else {
7 this.setState({ backgroundColor: "#DB4437" });
8 }
9}
10