Word Occurence in a list with RegEx

I've been using a bastardised version of WordInstance from Cflib.org that uses arrays instead of lists (for permormance reasons).Going over the code today i realised that occurances gets returned in the Sub Expression of REfind. So with some help from Tony Hicks on the CF-RegEx list i was able to re-write the function and got it down to the 4 lines below.
function wordOccurence(word,inList){
   var occurence = 0;
   occurence = reFind(",?\\b"&word&"\\b,?",inList,1,1);
   return occurence['len'][1];

comments powered by Disqus