<?xml version="1.0" encoding="windows-1252"?>
<node id="393841" title="Re: Please evaluate: RegEx for validating e-mail addresses" created="2004-09-25 16:23:49" updated="2005-04-20 13:38:34">
<type id="11">
note</type>
<author id="6035">
DaWolf</author>
<data>
<field name="doctext">
Please guys, let me make some statements here, since I was apparently misunderstood:
&lt;br&gt;&lt;br&gt;
I've understood [Ovid]'s post, [davido] and really appreciated his contribution (as usual), but I'd like to *learn* to build a regex for that matter.
&lt;br&gt;&lt;br&gt;
Just because a "standard" way of building it exists it's not unmutable, e.g.:
&lt;br&gt;&lt;br&gt;
[Ovid] first allows a whitespace and/or tab to be in the beginning of the e-mail address:

&lt;code&gt;
[\040\t]*
&lt;/code&gt;

I wouldn't do that. *My* line of thinking and the logic that reigns on the app I'm coding is: if the user has entered a whitespace in the beginning of the webform field, well, too bad for him. Even better, I'd write a JS function to disable whitespaces on that field. Since it's a web app it's better for me (and most probably for the user) to do it this way.
&lt;br&gt;&lt;br&gt;
The *only thing* I want to do is to validate an e-mail address (not something like "My name &lt;myemail@myserver.com&gt;") using a regex built by *me*. I want to learn that. I don't care if there is a module that already has this implemented. I don't care if there is a "generally accepted" way of doing it. I want to do it myself because I want to understand the full concept of it and then learn from it.
&lt;br&gt;&lt;br&gt;
All I've wanted was some advices and tips on how to do it and some critcics on my regex.
&lt;br&gt;&lt;br&gt;
So far in this node, only [Ovid] provided me that (with the link to the RFC and the addresses examples fom Mastering Regular Expressions).
&lt;br&gt;&lt;br&gt;
Cheers,
&lt;br&gt;&lt;br&gt;
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-6035"&gt;
&lt;BR&gt;&lt;HR style="width: 140px; height: 2px; color: rgb(128, 0, 0);"&gt;&lt;font face="Verdana, Arial, Helvetica, sans-serif" size="2"&gt;Er Galvão Abbott&lt;BR&gt;&lt;A HREF="http://www.galvao.eti.br/" target="_blank"&gt;www.galvao.eti.br&lt;/a&gt;&lt;BR&gt;&lt;A HREF="http://portoalegre.pm.org/" target="_blank"&gt;Porto Alegre Perl Mongers&lt;/a&gt;&lt;/font&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
393804</field>
<field name="parent_node">
393804</field>
</data>
</node>
