31
Oct

ruby email validation regex expression

this Regex Expression can handle ‘-’ character in Ruby email validation
^\w+((-\w+)|(\-)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$

Ruby Regex Expression test tool : http://www.rubular.com/

BTW:only test in ruby.

感谢ashchan 提供了可以支持Gmail 标签的正则表达式,经测试效果也不错,如下:
/^([^@\s!#\$%\^&\(\)]+)@((?:[-a-z0-9A-Z]+\.)+[a-zA-Z]{2,})$/

2 Comments so far

Leave a comment

Name(required)
Mail (will not be published)(required)
Website

Fields in bold are required. Email addresses are never published or distributed.

Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
URLs must be fully qualified (eg: http://www.raecoo.com),and all tags must be properly closed.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.

    About

    Tag Cloud