code: function escapeRegExp(str) {
    if (str && str.toString) str = str.toString();
    if (typeof str !== 'string' || !str.length) return '';
    return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
  }
docs: 生成安全的正则字符串
  @param {string} str
  @returns {string}