escape-regexp.js 503 B

123456789101112131415
  1. "use strict";
  2. /*
  3. Copyright 2019 Google LLC
  4. Use of this source code is governed by an MIT-style
  5. license that can be found in the LICENSE file or at
  6. https://opensource.org/licenses/MIT.
  7. */
  8. Object.defineProperty(exports, "__esModule", { value: true });
  9. exports.escapeRegExp = void 0;
  10. // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
  11. function escapeRegExp(str) {
  12. return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
  13. }
  14. exports.escapeRegExp = escapeRegExp;