开发者

Email Regex for single character domain names

开发者 https://www.devze.com 2023-03-11 11:03 出处:网络
I have the following regex that only works with two letter domains or more.I need this to work with single letter domains as well.Please suggest changes to the regex below.

I have the following regex that only works with two letter domains or more. I need this to work with single letter domains as well. Please suggest changes to the regex below.

^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\开发者_开发技巧{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$


\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b 


This regex will cover single letter domains.

\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号