这是用于印度本地手机号码验证和印度国际手机号码验证的正则表达式。
从9,8,7开始,你也可以添加更多。
电子邮件和密码
听说是代码
请尽快订阅制作视频我的Youtube频道
const status = validate();
if (status === true) {
alert('Login');
}
};
const doSignUp = () => {
const status = validate();
if (status === true) {
alert('Sign Up');
}
};
const validate = () => {
if (
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$/.test(
email
) &&
email.includes('.')
) {
if (
/^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,99}$/.test(password)
) {
if (
/^(?:(?:+|0{0,2})91(s*[-]s*)?|[0]?)?[6789]d{9}$/.test(
phoneNumber
)
) {
return true;
} else {
alert('Invalid Phone Number');
return false;
}
} else {
alert(
'Invalid, Password should contane Capital Letter, Small Letter , Number and Symbol'
);
return false;
}
} else {
alert('You have entered an invalid email address!');
return false;
}
};```
const status = validate();
if (status === true) {
alert('Login');
}
};
const doSignUp = () => {
const status = validate();
if (status === true) {
alert('Sign Up');
}
};
const validate = () => {
if (
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$/.test(
email
) &&
email.includes('.')
) {
if (
/^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,99}$/.test(password)
) {
if (
/^(?:(?:+|0{0,2})91(s*[-]s*)?|[0]?)?[6789]d{9}$/.test(
phoneNumber
)
) {
return true;
} else {
alert('Invalid Phone Number');
return false;
}
} else {
alert(
'Invalid, Password should contane Capital Letter, Small Letter , Number and Symbol'
);
return false;
}
} else {
alert('You have entered an invalid email address!');
return false;
}
};```