code: function(re, s, offset) {
    var res = s.slice(offset).match(re);
    if (res) {
      return offset + res.index;
    } else {
      return null;
    }
  }
docs: Attempt to match a regex in string s at offset offset. Return index of match or null.