summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/strings/quotemeta.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/locutus/php/strings/quotemeta.js')
-rw-r--r--node_modules/locutus/php/strings/quotemeta.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/node_modules/locutus/php/strings/quotemeta.js b/node_modules/locutus/php/strings/quotemeta.js
new file mode 100644
index 0000000..a1f2190
--- /dev/null
+++ b/node_modules/locutus/php/strings/quotemeta.js
@@ -0,0 +1,11 @@
+'use strict';
+
+module.exports = function quotemeta(str) {
+ // discuss at: http://locutus.io/php/quotemeta/
+ // original by: Paulo Freitas
+ // example 1: quotemeta(". + * ? ^ ( $ )")
+ // returns 1: '\\. \\+ \\* \\? \\^ \\( \\$ \\)'
+
+ return (str + '').replace(/([.\\+*?[^\]$()])/g, '\\$1');
+};
+//# sourceMappingURL=quotemeta.js.map \ No newline at end of file