I've set-up an online example/test area (http://jsfiddle.net/SZV3Q/1/) so you can play around with the code, but essentially I'm trying to figure out two things:

1. why 'undefined' is displayed first and how I can avoid it.
2. why the 3rd link (yahoo.com) is returning false when it should return true?

I'm sure I encountered a similar issue a few years ago with RegExp not quite doing what they were supposed to (I'm sure someone here suggested it was a bug to do with the modifier flags but I can't remember for sure).

Any help appreciated.

Kind regards,