Taken from blueprint common.js. Added space, hyphen and period support.