Blog This!   Lee Geistlinger's Web Log
Blog Home
Blog Archives
LittleGhost Home

E-mail: geistlinger AT gmail.com

Loading
Pic 'O the Day
Top 10 Lists
Everyone loves lists
Reviews
Books, Movies and so on
Blogroll
Feed Me!

XML Feed

Feeds I Read

My Online Aggregator

Theme
• Default
• Spring
• Summer
• Autumn
• Winter
• Black & White
• Gray & White
• MT-ish
• Classic
Listening To...
Evidence of Efforts

This page is powered by Blogger. Isn't yours?

Valid CSS!

[Valid RSS]

Recent Posts
 Sunday, November 02, 2003
Geek Love

I confess - we geeks are a strange breed. (Actually, it's surprising that we are allowed to breed...)

I had an algorithm for testing an e-mail address in Perl, but I just didn't like it. Wasn't robust enough for me.

I figured - and I'm sure I'm correct - that this has been a million times by a million people, and it would be for the taking somewhere on the Web.

Well, I found a couple of regexes that were close, but - again - not quite what I was looking for.

So I rolled my own (again...), and it think it's what I want.

If the e-mail address doesn't match this mask, invalid address:

/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])\.([a-zA-Z0-9_-]{2,4})/

Update 11/11/03: Improved below...
/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+\.([a-zA-Z]{2,4})$/


Notably, what this does that my other one didn't is the following:


Go ahead, embrace your inner and outer geek...

- Posted by Lee at 4:19 PM Permalink #
^Top | Top Ten Home | Blog This! Home | Blog This! Archives