code: function getIndexOf(string, find) {
      // if regex then do it regex way
      if(XRegExp.isRegExp(find)) {
        return string.search(find);
      } else {
        // normal way
        return string.indexOf(find);
      }
    }
docs: get index of using regex or normal way -1 other wise