Miquel, you can write the code more concisely with a regex, but I'm not convinced such code can provide any "better" of a check than non-reg-ex code. And, in fact, non-reg-ex code is generally faster in javascript than its regex equivalent.You can run a few quick benchmarks like so to see what I mean:
Date t1 = new Date(); // now
// do regex or non-regex check for ip addresses
dump(new Date() - t1); // msec elapsed
In any case, I'm not particular which way we implement it since this section of code isn't particularly sensitive to posible performance hits.
rich, thanks for the contribution. One of us (or you) needs to test this before committing it, though...