From 49fb9108e98aafb706f40a54bd3c354d90f36477 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 16 Jan 2017 02:49:08 +0100 Subject: [PATCH] Add Regexp possibility to titleReplace Check if the given needle is a regexp, if so create one and use it instead --- modules/default/calendar/calendar.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index b636b30b..d0527408 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -379,6 +379,13 @@ Module.register("calendar", { titleTransform: function (title) { for (var needle in this.config.titleReplace) { var replacement = this.config.titleReplace[needle]; + + var regParts = needle.match(/^\/(.+)\/([gim]*)$/); + if (regParts) { + // the parsed pattern is a regexp. + needle = new RegExp(regParts[1], regParts[2]); + } + title = title.replace(needle, replacement); }