[英]is there any way to make Custom Own regular expression for email, like i want to go with abc@xyz.com instead of abc@gmail.com.?
Is there any way to make Custom own email regular expression? 有什么方法可以使自定义自己的电子邮件正则表达式?
Actually I want to create one registration form in php and for email validation, 实际上,我想在php中创建一个注册表格并进行电子邮件验证,
I want to make my own customized email regular expression. 我想制作自己的自定义电子邮件正则表达式。 For example,lets say I want to check that the given mail is name-number@ves.ac.in
. 例如,让我说我要检查给定的邮件是name-number@ves.ac.in
。
It should only accept email id that ends with ves.ac.in
and should notify if given mail is not matching with expression. 它仅应接受以ves.ac.in
结尾的电子邮件ID,并应通知给定的邮件是否与表达式不匹配。 I did lot of experiment on: 我做了很多实验:
^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$
but this expression but failed. 但是这个表情却失败了。 please help. 请帮忙。
The right regex could be this: ^([a-zA-Z0-9_\\-\\.]+)@ves\\.ac\\.in$
正确的正则表达式可能是: ^([a-zA-Z0-9_\\-\\.]+)@ves\\.ac\\.in$
Here's a regex-tester 这是一个正则表达式测试器
if you are validating with jQuery or javascript, then you can validate using 如果您正在使用jQuery或javascript进行验证,则可以使用
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
if(!filter.test(email)){
// add error here
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.