寻找一个正则表达式来匹配一个 gmail 加地址 [英] Looking for a regex to match a gmail plus address
本文介绍了寻找一个正则表达式来匹配一个 gmail 加地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在使用这个:
/^(.*)\+(.*)@gmail.com/
(我正在捕获组中加号前后的文本)
(I'm capturing the text before and after the plus sign in a group)
它在大多数情况下都有效,例如test+test@gmail.com
但是如果我尝试匹配就会掉下来说test+++test@gmail.com
and it works in most cases such as
test+test@gmail.com
but falls down if I try to match say
test+++test@gmail.com
重复的 + 符号似乎搞砸了.
The repeated + signs seem to screw it up.
任何帮助将不胜感激.
谢谢
推荐答案
(.*?)\++(.*?)@gmail.com
应该可以工作.
这篇关于寻找一个正则表达式来匹配一个 gmail 加地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文