Regex empty string or email

前端 未结 7 1159
情深已故
情深已故 2020-11-29 20:46

I found a lot of Regex email validation in SO but I did not find any that will accept an empty string. Is this possible through Regex only? Accepting either empty string or

7条回答
  •  攒了一身酷
    2020-11-29 21:05

    this will solve, it will accept empty string or exact an email id

    "^$|^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"
    

提交回复
热议问题