code: function rangesFromMatches(word, text, selector) {
    var ret = [], match;
    var re = new RegExp('\\b'+word+'\\b', 'gi');
    while ((match = re.exec(text)) !== null) {
      GLOBAL.debug(text.length, text.substring(0, 10), word, match.index, text.substr(match.index, word.length));
       ret.push(annoLib.createRange({exact: text.substr(match.index, word.length), offset: match.index, selector: selector}));
    }
    return ret;
  }
docs: convert instances of a match to ranges