If I take the value from a tiddler field like {{!!add.filter}} then it
works fine but I need to check and clean this value before it goes to the
filter. Otherwise [search:text:regexp{!!add.filter}] crashes my wiki if it
contains "||" somewhere or "|" at the edge. There shoud be more checks but
I start with this one.
So i've made JS macro and checked its results - ok. It replaces || to | and
removes | prefix an suffix
...
exports.run = function(regexp) {
regexp= regexp.replace(/([\|\\\{\}]){2,}/g, "$1");
regexp= regexp.replace(/^([\|]){1,}/g, "");
regexp= regexp.replace(/([\|]){1,}$/g, "");
return regexp;
};
But when I
\define validFilter()<$macrocall $name="validateregexp"
regexp={{!!add.filter}}/>
and change filter
[search:text:regexp{!!add.filter}]
to
[search:text:regexp<validFilter>]
then the second filter always returns nothing even if {!!add.filter}
and <validFilter> are equal and the first filter works correctly.
I would like to understand why. And how I should apply my macro to the
filter.
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/a3c8adc8-18be-4ae4-a6f8-609270347c2dn%40googlegroups.com.