RegEx Challenge III

I admit I'm mentally weak. I can usually get a regular expression to work until I have to come up with something to NOT match. Here's today's challenge. Match only e-mail addresses that are NOT preceded by a colon or closing bracket. Your test string is this:

test[url="mailto:name1@domain.com"]name2@domain.com name3@domain.com test

Only name3@domain.com should return a match. For simplicity's sake, I'm using this for the actual e-mail address matching (I realize it isn't perfect and may allow non-RFC compliant addresses through):

([\w\-\.]*@([\w\-])+(\.[\w\-]+)+)

Here's a handy test page. The prize is grand recognition and a pat on the back. It's the best I can offer... I'm poor. :)

6 Comments

Comments have been disabled for this content.