Filter that returns only the first suffix word after a given prefix

39 views
Skip to first unread message

S. S.

unread,
Feb 9, 2019, 11:11:00 PM2/9/19
to tiddl...@googlegroups.com

On tiddlywiki.com I go to the Advanced Search, Shadows tab, and search for (the prefix): $:/core/ui/ControlPanel/

I get about 50 results.
The only ones I am interested in are the ones that have a single word after that prefix.
Example: I am interested in  $:/core/ui/ControlPanel/Saving but NOT $:/core/ui/ControlPanel/Saving/DownloadSaver

I need help in writing a Filter that will:
1. Find only the tiddlers I am interested in (I can't think of a way to do this)
2. Return all those single words (remove the prefix)

From the above example, it would return: Saving

Thanks

Edit: Small spelling correction

Mal

unread,
Feb 10, 2019, 12:07:56 AM2/10/19
to TiddlyWiki
S.S.,

I think you can do this with the removeprefix operator, which filters by and removes the prefix, followed by splitbefore to keep everything up to and including a delimiter. You might also need removesuffix to get rid of the delimiter.

Sorry, I'm working on my phone at the moment so haven't actually tried this.

Regards,

Mal

S. S.

unread,
Feb 10, 2019, 12:13:51 AM2/10/19
to TiddlyWiki
Thanks Mal.

It is a relaxed Sunday morning so I posted the question here instead of thinking about it.
Felt bad for being so lazy so I decided to RTFM to see if I could do it myself.

<$list filter="[all[shadows]prefix[$:/core/ui/ControlPanel/]removeprefix[$:/core/ui/ControlPanel/]splitbefore[/]!suffix[/]]">

</$list>

Wasn't as hard as I first thought!

Cheers

Mohammad

unread,
Feb 10, 2019, 1:40:36 AM2/10/19
to TiddlyWiki
S.S.
 Thanks for sharing!
Added to TW-Scripts.

--Mohammad
Reply all
Reply to author
Forward
0 new messages