[英]regex emails separated with slashes
How do I make sure all the emails is separated with slashes in html pattern? 如何确保所有电子邮件均在html模式中用斜杠分隔? Below is what I have so far. 以下是到目前为止的内容。 (Regex novice here) (正则表达式新手在这里)
^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[az]+[/]{1,4}$
Currently: 目前:
abc@abc.com,abc@abc.com
false abc@abc.com,abc@abc.com
abc@abc.com/def@def.com
false abc@abc.com/def@def.com
abc@abc.com/aaa@aaa.com/
false abc@abc.com/aaa@aaa.com/
false abc@abc.com/
true abc@abc.com/
是 My goals: 我的目标:
abc@abc.com,abc@abc.com
false abc@abc.com,abc@abc.com
abc@abc.com/def@def.com
true abc@abc.com/def@def.com
是 abc@abc.com/aaa@aaa.com/
false abc@abc.com/aaa@aaa.com/
false abc@abc.com/
false abc@abc.com/
false abc@abc.com
true abc@abc.com
是 Use a quantified group to allow any number (including 0) of emails followed by /
at the beginning, and then a single email at the end. 使用量化组可允许任意数量(包括0)的电子邮件,后跟/
,然后是一封电子邮件。
^(?:[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]+\/)*[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]+$
If you only want to allow 1-4 emails, change the *
to {0,3}
. 如果只允许1-4封电子邮件,请将*
更改为{0,3}
。 This is only 0-3 because it only counts the 3 emails with /
after them, not the email at the end. 这仅是0-3,因为它只计算带/
的3封电子邮件,而不是末尾的电子邮件。
To limit the total size, you can use a lookahead at the beginning: 要限制总大小,可以在开始时使用前瞻:
^(?=.{0,320}$)(?:[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]+\/)*[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]+$
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.