Invalid regular expression: unmatched parentheses

Unmatched ) in Javascript regular expression您的某些字符串包含错误')'。你需要逃避这个。这是这样做的功能:

function escapeRegExp(str) {
  return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}

 

posted @ 2017-06-28 15:52  ma_fighting  阅读(2080)  评论(0编辑  收藏  举报
历史天气查