mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-15 22:31:24 +00:00
Getting ready for using RegExp for search
So that we can do case insensitivity and partial matches
This commit is contained in:
@@ -221,6 +221,13 @@ exports.stringify = function(s) {
|
|||||||
.replace(/[\x80-\uFFFF]/g, exports.escape); // non-ASCII characters
|
.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) {
|
exports.nextTick = function(fn) {
|
||||||
/*global window: false */
|
/*global window: false */
|
||||||
if(typeof window !== "undefined") {
|
if(typeof window !== "undefined") {
|
||||||
|
|||||||
Reference in New Issue
Block a user