[544]=>Good morning
 [543]=>You know the fee...
 [542]=>Date more, care ...
 [541]=>Moving On



June 2004
sun mon tue wed thu fri sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      


 [RAndoMness]=> 28Sep09
 [JPsDocs] => 22Feb09
 [JPics] => 10Dec11

recent music
Boycott SONY


getentries(07Dec03);   getentries(07Dec03);


Bug in verifying email adresses in Mac JavaScript
added Wed June 30 2004 at 11:44 PM
David loves to tell me how much a pain PCs are, so I figured I'd comment on this bug that I ran into on the mac today. Most of the questions people ask are a result of either general comuter idiocy (no offense, they admit it themselves) or people installing popup blockers and not catching on to how to disable them. Every once in a while, we get a real stumper involving bugs in the page. Such was the case today.

The advantage and disadvantage of JavaScript is that everything is taken care of on the user's computer instead of on the server. If you're dealing with a server technology (PHP, ColdFusion, ASP .NET, etc), then you don't have to worry about how the foreign computer is going to treat it, as long as the browser gives you the information correctly (they almost unfailingly do). WIth JavaScript, however, each computer and each browser treats things a little bit differently. Usually (hopefully), it's just a matter of things looking a bit different, but occasionally one browser or computer simply doesn't handle things the way they're supposed to.

Alright, enough background info, now to the meat of what the Mac screwed up. The script was refusing any email with an underscore ('_') in it. In a validation script for the submission form, we had the following:
var reg =/^[a-zA-Z0-9][\w\.\-]*[a-zA-Z0-9]@[a-zA-Z0-9] [\w\.\-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
(all on one line, of course)

if (!reg.test(str)) // str is not a valid email...

In a nutshell, that says that the regular expression has to start with an alphanumeric character, followed by any number of alphanumeric plus '.','_', and '-'and then at least one alphanumeric before the '@' sign, followed again by alphanumeric, etc...

There's more to read. Read the extended entry.