Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9339298
index.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
607 B
Subscribers
None
index.js
View Options
"use strict"
;
/**
* RegexEscape
* Escapes a string for using it in a regular expression.
*
* @name RegexEscape
* @function
* @param {String} input The string that must be escaped.
* @return {String} The escaped string.
*/
function
RegexEscape
(
input
)
{
return
input
.
replace
(
/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g
,
"\\$&"
);
}
/**
* proto
* Adds the `RegexEscape` function to `RegExp` class.
*
* @name proto
* @function
* @return {Function} The `RegexEscape` function.
*/
RegexEscape
.
proto
=
function
()
{
RegExp
.
escape
=
RegexEscape
;
return
RegexEscape
;
};
module
.
exports
=
RegexEscape
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Jul 4 2025, 9:35 AM (5 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3327870
Attached To
rDWAPPS Web applications
Event Timeline
Log In to Comment