filter only tiddler that have one tag with a specific value

85 views
Skip to first unread message

vpl

unread,
Mar 18, 2020, 5:35:29 PM3/18/20
to TiddlyWiki
Hi guys

I try to build a filter that matches only tiddlers that have one tag and this tag must have a specific name (in the example 'track')

I've tried using the regexp on tags with the regex quantity operator {} but that does not work .. it returns also tracks with multiple tags (one of them beeing 'track')

<$list filter="[regexp:tags[track{1}]sort[exp_date]reverse[]]">

Any idea to save me ?

Thanks for your help

Regards

TonyM

unread,
Mar 18, 2020, 5:58:36 PM3/18/20
to TiddlyWiki
VPL

As usual there are a number of ways to tackle any requirement in tiddlywiki

You can compare the output of the tags operator (each tag) with the actual tags field, if they are the same there is one tag
<$list filter="[all[current]tags[]match{!!tags}]">

</$list>

but in your case
<$list filter="[[track]match{!!tags}]">

</$list>

Is this what you were after?

Other tricks include
  • counting the number of tags with the count operator
  • Other search, contains or comparison operators
Regards
Tony

TonyM

unread,
Mar 18, 2020, 6:09:28 PM3/18/20
to TiddlyWiki
VPL,

A Recent test suggest this is not working with tags containing spaces.

Regards
Tony

Mark S.

unread,
Mar 18, 2020, 8:35:27 PM3/18/20
to TiddlyWiki
Your regular expression quantity operator doesn't work because curly brackets, angle brackets, and square brackets are reserved inside of filters. To get around this, define the search inside of variables where those bracket types are allowed. Here's an example searching for tiddler searching for tiddlers tagged with only HelloThere on TiddlyWiki.com

<$vars myreg="(^HelloThere$){1}">
<$list filter="[tag[HelloThere]regexp:tags
<myreg>]">

</$list>
</$vars>


vpl

unread,
Mar 19, 2020, 4:22:57 AM3/19/20
to TiddlyWiki
Hi Guys

Thanks a lot both of you for your quick support

I've just tested the regexp approach and it works !
Thanks a lot

Regards
Reply all
Reply to author
Forward
0 new messages