okay i hope no one flames me for posting something thats really about javascript, but then again my toiling is ultimately geared towards a jquery plugin, so maybe you will forgive me...
the code sample below uses a prototype function that searches an array. There is a sampe array, and then I am trying to test it with the alert(). it works fine when I just search for something like 30 or "blue" (uncomment the other vars below to check for yourself), but it returns FALSE if I use a regex. The prototype seems to be commonly known because it's the only one I keep coming across when searching fopr this... Anybody got any ideas on how to make the regex work? I've searched all evening... Thanks! Array.prototype.find = function(searchStr) { var returnArray = false; for (i=0; i<this.length; i++) { if (typeof(searchStr) == 'function') { if (searchStr.test(this[i])) { if (!returnArray) { returnArray = [] } returnArray.push(i); } } else { if (this[i]===searchStr) { if (!returnArray) { returnArray = [] } returnArray.push(i); } } } return returnArray; } var tmp = [5,9,12,18,56,1,10,42,'blue',30, 7,97,53,'gcycle', 30,35,27,30,'35','Ball', 'bubble']; var regexp1=tmp.find(/^Bal/); //var regexp1=tmp.find(/^b/); //var regexp1=tmp.find(30); alert(regexp1);