<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fedora &#187; Rails</title>
	<atom:link href="http://gofedora.com/archives/category/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://gofedora.com</link>
	<description>How Tos, Tutorials, Tips and Tricks</description>
	<lastBuildDate>Wed, 14 Sep 2011 15:10:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>TIP: Simple Regular Expression for Email Validation</title>
		<link>http://gofedora.com/tip-simple-regular-expressi-email-validation/</link>
		<comments>http://gofedora.com/tip-simple-regular-expressi-email-validation/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 20:09:57 +0000</pubDate>
		<dc:creator>Kulbir Saini</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Tips - Tricks]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[Email Validation]]></category>
		<category><![CDATA[Regex]]></category>
		<category><![CDATA[Regular Expression]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://gofedora.com/?p=667</guid>
		<description><![CDATA[
I was playing around with Ruby on Rails and needed an email field for some application. I thought of validating the email address before actually saving it. Googled for same and got tons of results, but none of them was perfect. Few were somewhat exhaustive but horribly difficult to understand and those which were simple [...]<p><a href="http://gofedora.com/">Fedora Tutorials</a> and <a href="http://cachevideos.com/">Videocache</a> by <a href="http://saini.co.in/">Kulbir Saini</a>.</p>
]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://gofedora.com/tip-simple-regular-expressi-email-validation/" title="Permanent link to TIP: Simple Regular Expression for Email Validation"><img class="post_image alignnone" src="http://gofedora.com/wp-content/uploads/2009/08/Email-Validation-Regular-Expression.jpg" width="384" height="271" alt="Email Validation (Regular Expression)" title="TIP: Simple Regular Expression for Email Validation" /></a>
</p><p>I was playing around with Ruby on Rails and needed an email field for some application. I thought of validating the email address before actually saving it. Googled for same and got tons of results, but none of them was perfect. Few were somewhat exhaustive but horribly difficult to understand and those which were simple were  not exhaustive enough for practical use. I thought I&#8217;ll just write the regex myself and came up with the following. I have tested it for few weird cases like an email hosted on a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.exmaple.com (a subdomain deep down the hierarchy) etc.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">^<span style="color: #7a0874; font-weight: bold;">&#91;</span>A-Za-z0-9._<span style="color: #000000; font-weight: bold;">%</span>+-<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>A-Za-z0-<span style="color: #000000;">9</span>-<span style="color: #7a0874; font-weight: bold;">&#93;</span>+\.<span style="color: #7a0874; font-weight: bold;">&#41;</span>+<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>A-Za-z0-<span style="color: #000000;">9</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">2</span>,<span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">|</span>museum<span style="color: #7a0874; font-weight: bold;">&#41;</span>$</pre></div></div>

<p>I hope it&#8217;ll be of help. And don&#8217;t forget to pen down your suggestions via comments.</p>
<p><a href="http://gofedora.com/">Fedora Tutorials</a> and <a href="http://cachevideos.com/">Videocache</a> by <a href="http://saini.co.in/">Kulbir Saini</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gofedora.com/tip-simple-regular-expressi-email-validation/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

