mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
react app
This commit is contained in:
32
react-app/node_modules/lodash/string/escapeRegExp.js
generated
vendored
Normal file
32
react-app/node_modules/lodash/string/escapeRegExp.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
var baseToString = require('../internal/baseToString'),
|
||||
escapeRegExpChar = require('../internal/escapeRegExpChar');
|
||||
|
||||
/**
|
||||
* Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns)
|
||||
* and those outlined by [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern).
|
||||
*/
|
||||
var reRegExpChars = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,
|
||||
reHasRegExpChars = RegExp(reRegExpChars.source);
|
||||
|
||||
/**
|
||||
* Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?",
|
||||
* "*", "+", "(", ")", "[", "]", "{" and "}" in `string`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category String
|
||||
* @param {string} [string=''] The string to escape.
|
||||
* @returns {string} Returns the escaped string.
|
||||
* @example
|
||||
*
|
||||
* _.escapeRegExp('[lodash](https://lodash.com/)');
|
||||
* // => '\[lodash\]\(https:\/\/lodash\.com\/\)'
|
||||
*/
|
||||
function escapeRegExp(string) {
|
||||
string = baseToString(string);
|
||||
return (string && reHasRegExpChars.test(string))
|
||||
? string.replace(reRegExpChars, escapeRegExpChar)
|
||||
: (string || '(?:)');
|
||||
}
|
||||
|
||||
module.exports = escapeRegExp;
|
Reference in New Issue
Block a user