# Check for valid email address

**URL:** <https://www.ruby-forum.com/t/check-for-valid-email-address/152567>\
**Category:** Ruby\
**Created:** [November 5, 2008, 8:02am UTC](https://www.ruby-forum.com/t/check-for-valid-email-address/152567 "2008-11-05T08:02:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [November 5, 2008, 8:02am UTC](https://www.ruby-forum.com/t/check-for-valid-email-address/152567/1 "2008-11-05T08:02:34Z")

</div>

Hi  
I have a text field mail\_id I have to prevent the user to enter only  
a valid mail id For example removed\_email\_address@domain.invalid Could you please tell  
how can I check that?

Thanks in advance  
Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [November 5, 2008, 8:48am UTC](https://www.ruby-forum.com/t/check-for-valid-email-address/152567/2 "2008-11-05T08:48:17Z")

</div>

Sijo Kg wrote:

> Hi  
> I have a text field mail\_id I have to prevent the user to enter only  
> a valid mail id For example removed\_email\_address@domain.invalid Could you please tell  
> how can I check that?
> 
> Thanks in advance  
> Sijo

Look into regular expressions and try it yourself

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [November 5, 2008, 2:21pm UTC](https://www.ruby-forum.com/t/check-for-valid-email-address/152567/3 "2008-11-05T14:21:40Z")

</div>

On Wed, Nov 5, 2008 at 2:46 AM, Wouss B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Sijo Kg wrote:
> 
> > Hi  
> > I have a text field mail\_id I have to prevent the user to enter only  
> > a valid mail id For example removed\_email\_address@domain.invalid Could you please tell  
> > how can I check that?
> > 
> > Thanks in advance  
> > Sijo
> 
> Look into regular expressions and try it yourself

This is a good place to start for regular expressions for email:  
[How to Find or Validate an Email Address](http://www.regular-expressions.info/email.html) . The site itself is good  
overall.

Regards,  
Craig
