<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How to validate email format via JavaScript</title>
	<atom:link href="http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/</link>
	<description>Random Snippets of Code and Ideas for any Web Developer</description>
	<lastBuildDate>Sat, 17 Jul 2010 11:08:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: hani</title>
		<link>http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/comment-page-1/#comment-8992</link>
		<dc:creator>hani</dc:creator>
		<pubDate>Thu, 03 Dec 2009 16:29:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=13#comment-8992</guid>
		<description>thanks^_^</description>
		<content:encoded><![CDATA[<p>thanks^_^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/comment-page-1/#comment-2613</link>
		<dc:creator>John</dc:creator>
		<pubDate>Fri, 17 Apr 2009 16:59:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=13#comment-2613</guid>
		<description>That was really helpful, thank you!

I&#039;m working on a project where i need to &quot;format&quot; the input string from html Text Inputs in javascript, that is what i meant. I needed the email format u mentioned and i also needed a regex that applies to numbers from 1 to 100.

So i came up with:
var ageFormat=/\d{1,3}/g;
which applies to 1 to 3 digit number, and then an If statement to restrict the numbers between 1 and 100.

Thanks again!</description>
		<content:encoded><![CDATA[<p>That was really helpful, thank you!</p>
<p>I&#8217;m working on a project where i need to &#8220;format&#8221; the input string from html Text Inputs in javascript, that is what i meant. I needed the email format u mentioned and i also needed a regex that applies to numbers from 1 to 100.</p>
<p>So i came up with:<br />
var ageFormat=/\d{1,3}/g;<br />
which applies to 1 to 3 digit number, and then an If statement to restrict the numbers between 1 and 100.</p>
<p>Thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Knix</title>
		<link>http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/comment-page-1/#comment-2609</link>
		<dc:creator>Knix</dc:creator>
		<pubDate>Fri, 17 Apr 2009 16:12:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=13#comment-2609</guid>
		<description>Hi John,

Here is the breakdown of the regex:

^ = Matches the beginning of the string.

[A-Z0-9._%+-] = Bracket expression that will match any letter(A-Z), any number (0-9), dot (.), underscore (_), percent sign (%), plus(+), and minus (-).

+ = This will match the preceding element, in this case the bracket expression, 1 or more times. In summary the bracket expression with the (+) will match a person’s email alias.

@ = Match the (@) symbol in the email address.
[A-Z0-9.-] = Bracket expression that will match any letter(A-Z), any number (0-9), dot (.), and minus (-).

+ = This will match the preceding element, in this case the bracket expression, 1 or more times.

\. = The dot (.) in this case is matched and it is escaped with the backslash (\) because the dot by itself is used to match any single character when used in a regex (when it is outside of a bracket expression).

[A-Z] = Bracket expression that will match any letter(A-Z).

{2,4} = Matches the preceding element at least 2 times and not more than 4 times. In summary the bracket expression with the ({2,4}) will match the top-level domain name such as com, net, or info.

I do not understand what you mean by “format a string” though. Can you please expand on that?</description>
		<content:encoded><![CDATA[<p>Hi John,</p>
<p>Here is the breakdown of the regex:</p>
<p>^ = Matches the beginning of the string.</p>
<p>[A-Z0-9._%+-] = Bracket expression that will match any letter(A-Z), any number (0-9), dot (.), underscore (_), percent sign (%), plus(+), and minus (-).</p>
<p>+ = This will match the preceding element, in this case the bracket expression, 1 or more times. In summary the bracket expression with the (+) will match a person’s email alias.</p>
<p>@ = Match the (@) symbol in the email address.<br />
[A-Z0-9.-] = Bracket expression that will match any letter(A-Z), any number (0-9), dot (.), and minus (-).</p>
<p>+ = This will match the preceding element, in this case the bracket expression, 1 or more times.</p>
<p>\. = The dot (.) in this case is matched and it is escaped with the backslash (\) because the dot by itself is used to match any single character when used in a regex (when it is outside of a bracket expression).</p>
<p>[A-Z] = Bracket expression that will match any letter(A-Z).</p>
<p>{2,4} = Matches the preceding element at least 2 times and not more than 4 times. In summary the bracket expression with the ({2,4}) will match the top-level domain name such as com, net, or info.</p>
<p>I do not understand what you mean by “format a string” though. Can you please expand on that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/comment-page-1/#comment-2599</link>
		<dc:creator>John</dc:creator>
		<pubDate>Fri, 17 Apr 2009 11:02:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=13#comment-2599</guid>
		<description>Hello,
Can u give any furhter explanation about the expression on line 3:

var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;

My actual question is how can i format a string?

Thx!</description>
		<content:encoded><![CDATA[<p>Hello,<br />
Can u give any furhter explanation about the expression on line 3:</p>
<p>var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;</p>
<p>My actual question is how can i format a string?</p>
<p>Thx!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Knix</title>
		<link>http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/comment-page-1/#comment-535</link>
		<dc:creator>Knix</dc:creator>
		<pubDate>Thu, 16 Oct 2008 06:58:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=13#comment-535</guid>
		<description>Hi Peter,

The regular expression in line 3 of the &lt;b&gt;verifyEmail&lt;/b&gt; function does just that and even checks the alias.</description>
		<content:encoded><![CDATA[<p>Hi Peter,</p>
<p>The regular expression in line 3 of the <b>verifyEmail</b> function does just that and even checks the alias.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Breyfoge</title>
		<link>http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/comment-page-1/#comment-527</link>
		<dc:creator>Peter Breyfoge</dc:creator>
		<pubDate>Wed, 15 Oct 2008 14:44:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=13#comment-527</guid>
		<description>How about checking that there is at least one @ sign and it is followed by at least one period and a proper domain name?</description>
		<content:encoded><![CDATA[<p>How about checking that there is at least one @ sign and it is followed by at least one period and a proper domain name?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Knix</title>
		<link>http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/comment-page-1/#comment-174</link>
		<dc:creator>Knix</dc:creator>
		<pubDate>Thu, 31 Jul 2008 23:43:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=13#comment-174</guid>
		<description>You are right.  Thanks for pointing that out.  I have restructured the code accordingly and it looks much better.  Thanks for the suggestion.</description>
		<content:encoded><![CDATA[<p>You are right.  Thanks for pointing that out.  I have restructured the code accordingly and it looks much better.  Thanks for the suggestion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: some</title>
		<link>http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/comment-page-1/#comment-173</link>
		<dc:creator>some</dc:creator>
		<pubDate>Thu, 31 Jul 2008 23:26:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=13#comment-173</guid>
		<description>That:
function verifyEmail(){
...
     if (...) {
...
          return false;
     }
     else if (...) {
...
          return false;
...

That code is not well structured.
it should be one, and only one return from the function.</description>
		<content:encoded><![CDATA[<p>That:<br />
function verifyEmail(){<br />
&#8230;<br />
     if (&#8230;) {<br />
&#8230;<br />
          return false;<br />
     }<br />
     else if (&#8230;) {<br />
&#8230;<br />
          return false;<br />
&#8230;</p>
<p>That code is not well structured.<br />
it should be one, and only one return from the function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Knix</title>
		<link>http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/comment-page-1/#comment-172</link>
		<dc:creator>Knix</dc:creator>
		<pubDate>Thu, 31 Jul 2008 22:44:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=13#comment-172</guid>
		<description>Hi Marie,

You can try checking the string length of the input value:

&lt;code&gt;
if (input_name.value.length() &gt; 0) {
    do something...
}
&lt;/code&gt;

I hope this information helps.  Good luck!</description>
		<content:encoded><![CDATA[<p>Hi Marie,</p>
<p>You can try checking the string length of the input value:</p>
<p><code><br />
if (input_name.value.length() > 0) {<br />
    do something...<br />
}<br />
</code></p>
<p>I hope this information helps.  Good luck!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marie</title>
		<link>http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/comment-page-1/#comment-171</link>
		<dc:creator>marie</dc:creator>
		<pubDate>Thu, 31 Jul 2008 22:13:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=13#comment-171</guid>
		<description>Please ignore my previous email about 2 hours ago.
My question really is --- how to detect/verify that my user did not enter anything in a input file. 
I use the 
...input_name.value == null or 
...input_name.value == &quot;&quot; none of them works.
Your help is very much appreciated.</description>
		<content:encoded><![CDATA[<p>Please ignore my previous email about 2 hours ago.<br />
My question really is &#8212; how to detect/verify that my user did not enter anything in a input file.<br />
I use the<br />
&#8230;input_name.value == null or<br />
&#8230;input_name.value == &#8220;&#8221; none of them works.<br />
Your help is very much appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marie</title>
		<link>http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/comment-page-1/#comment-170</link>
		<dc:creator>marie</dc:creator>
		<pubDate>Thu, 31 Jul 2008 20:26:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/?p=13#comment-170</guid>
		<description>In my HTML script, I ask user to enter his/her first and last name, address, state, etc. If user skips it, I&#039;d like to display an &quot;alert&quot; to remind for input data. How to detect if the input is empty or just blank spaces are entered.</description>
		<content:encoded><![CDATA[<p>In my HTML script, I ask user to enter his/her first and last name, address, state, etc. If user skips it, I&#8217;d like to display an &#8220;alert&#8221; to remind for input data. How to detect if the input is empty or just blank spaces are entered.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
