var regxp = /[\\S]/; //any char, not sure if it\'s /.*/ or something else var obj = { atr1: \"bla\" } var blahs = obj[regxp]; //returns atr1
I\'m
your regex will match a single non-space character.
for...in is a loop. it's slower than what exactly? have you benchmarked?
for...in
if you want to look up properties using a regex, you'll have to do it in a loop.
for(var k in obj) { if(regexp.match(k)) { // do whatever } }