I’m trying to find a way to do something I thought would be relatively simple but is turning out to rather scramble my brain. I’m just looking to produce a bunch of links to some of the tag tiddlers of the current tiddler. Easy enough, but then I want to shorten the display of those links to remove the prefix. What I have so far is:
I ideally want the link to display without "Session Logs: " at the start. Is there a simple way to do a replace on a bit of text, or to remove the start of it?
Certainly. Your current code uses {{!!title}} for the link text, but you can replace this with any other content you’d like to display — including the output of another widget. Here, I’d recommend using the $text widget to display the result of a filtered transclusion as plain text:
I used trim here as it’s simple and semantically clear, but for other forms of text replacement, you may also want to take a look at search-replace.
Incidentally, the $link widget defaults to using to={{!!title}} as its default target and {{!!title}} as its default display text, so if you do want a “normal” link that simply displays the name of its destination, you can simplify <$link to={{!!title}}>{{!!title}}</$link> to <$link/>.
I tried to use search-replace more than once in the same filter, sometimes with regexp. And I couldn’t do it.
I am not sure if this is something wrong with my syntax.
But I found a way to accommodate this is to use [split[too many words]] and [join[two words]] multiple times in the same filter. This allowed me to brake up a line, and the insert new text in that place like multiple search-replace uses.
Is that good, or is there a better way to do that?
Well, in some ways, any solution that accomplishes your desired result is a good solution — particularly if it’s one that you fully understand. The split + join combo may not be the most efficient method, but it’s clever and creative, and it sounds like it worked for you. Good job!
I do think it’s likely that you were encountering some syntactical error in your search-replace attempts, though; it’s definitely possible to use it more than once in a filter run, with or without the :regexp flag. If you can recall what you tried that didn’t work, I’d be happy to try to troubleshoot it for you.