1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-27 22:58:19 +00:00

Getting ready for using RegExp for search

So that we can do case insensitivity and partial matches
This commit is contained in:
Jeremy Ruston 2012-10-17 19:10:48 +01:00
parent 81a565e608
commit 5e2c3db385

View File

@ -221,6 +221,13 @@ exports.stringify = function(s) {
.replace(/[\x80-\uFFFF]/g, exports.escape); // non-ASCII characters
};
/*
Escape the RegExp special characters with a preceding backslash
*/
exports.escapeRegExp = function(s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
};
exports.nextTick = function(fn) {
/*global window: false */
if(typeof window !== "undefined") {