电子邮件模式的正则表达式 [英] Regular expression for email pattern

查看:83
本文介绍了电子邮件模式的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我使用下面这个表达式来验证电子邮件

 / ^([0-9a-zA-Z _] + [-._ +])* [0 -9a-zA-Z _] + @([ -  0-9a-zA-Z] + [。])+ [a-zA-Z] {2,6} $ / 


工作正常。但是当用户在@符号之前输入 _时,我需要提供验证提醒。喜欢这封电子邮件[abc_C _ @ abc.com]



我不知道怎么删除。所以请建议我尽快关闭它



我尝试过:



如果我删除_则将考虑整个下划线。

解决方案

/



其工作正常。但是当用户在@符号
之前输入 _时,我需要提供验证提醒。喜欢这封电子邮件[abc_C _ @ abc.com]



我不知道怎么删除。所以请建议我尽快关闭它



我尝试过:



如果我删除_则将考虑整个下划线。


引用:

我要'知道如何删除。

为什么要删除完全合法的_。



以下是RegEx文档的链接:

perlre - perldoc.perl.org [ ^ ]

以下是帮助构建RegEx并调试它们的工具的链接:

.NET正则表达式测试程序 - 正则表达式风暴 [ ^ ]

Expresso正则表达式工具 [ ^ ]

这个显示RegEx是一个很好的图表,它非常有助于理解RegEx的作用:

Debuggex:在线可视正则表达式测试器。 JavaScript,Python和PCRE。 [ ^ ]


试试这个,



/^([0-9a-zA-Z_]+ [ - ._+])* [0-图9a-ZA-Z] + @([ - 。0-9A-ZA-Z] + [])+ [A-ZA-Z] {2,6-}

Hi im using this this below expression to validated email

/^([0-9a-zA-Z_]+[-._+])*[0-9a-zA-Z_]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$/


its working fine. but i need to give the validation alert when user entered _ before the @ symbol. like this email[abc_C_@abc.com]

i dont know how to remove. so pls advice me to close it shortly

What I have tried:

if i remove _ then the entire underscore will be consider.

解决方案

/


its working fine. but i need to give the validation alert when user entered _ before the @ symbol. like this email[abc_C_@abc.com]

i dont know how to remove. so pls advice me to close it shortly

What I have tried:

if i remove _ then the entire underscore will be consider.


Quote:

i don't know how to remove.

Why do you want to remove the _ which is perfectly legal.

Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]


try this,

/^([0-9a-zA-Z_]+[-._+])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}


这篇关于电子邮件模式的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆