Looking for a regex to match a gmail plus address

前端 未结 7 1417
梦如初夏
梦如初夏 2021-01-25 08:25

Im using this currently :

/^(.*)\\+(.*)@gmail.com/

(I\'m capturing the text before and after the plus sign in a group)

and it works in most

7条回答
  •  悲&欢浪女
    2021-01-25 08:57

    If you don't care about validating the first portion of the address (prior to any '+') you could go with /^([^+]+)(:?+[^+]*)*@gmail.com/ to just the first part.

    You may want to do better validation on that to ensure that it is a "valid" account format, according to whatever rules are set forth by RFC.

    edit -- asterisks were making a bold statement.

提交回复
热议问题