This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

substitute Operator (Examples)

21st October 2025 at 2:04pm

Substitute operator parameters

The following example uses a function definition and a function call with a filter expression

\function f.text() [[Hi, I'm $1$ and I live in $2$]substitute[Bugs Bunny],[Rabbit Hole Hill]]

<<f.text>>

That renders as:

Hi, I'm Bugs Bunny and I live in Rabbit Hole Hill


The following example uses a filtered transclusion with a filter expression creating a link and a text output.

link: {{{ [[Hi, I'm $1$ and I live in $2$]substitute[Bugs Bunny],[Rabbit Hole Hill]] }}}

text: <$text text={{{ [[Hi, I'm $1$ and I live in $2$]substitute[Bugs Bunny],[Rabbit Hole Hill]] }}}/>

That renders as:

link: Hi, I'm Bugs Bunny and I live in Rabbit Hole Hill

text: Hi, I'm Bugs Bunny and I live in Rabbit Hole Hill

Substitute variables and parameters

The following example uses variable definitions "name", "address", a filtered transclusion assigned to a text-widget. The variables "name" and "address" are used as substitute parameters.

\procedure name() Bugs Bunny
\procedure address() Rabbit Hole Hill

<$text text={{{ [[Hi, I'm $1$ and I live in $2$]substitute<name>,<address>] }}}/>

That renders as:

Hi, I'm Bugs Bunny and I live in Rabbit Hole Hill

Substitute $(variables)$

The following examples use the variables "name" and "address" and directly substitute the with the attribute substitution syntax.

\procedure name() Bugs Bunny
\procedure address() Rabbit Hole Hill

<$text text=`Hi, I'm $(name)$ and I live in $(address)$`/>

That renders as:

Hi, I'm Bugs Bunny and I live in Rabbit Hole Hill

Substitute a filter expression and a variable

The following example uses a procedure, that defines the text with substitution placeholders. $(field)$ is defined as a variable. ${ ... }$ is filtered substitution placeholder.

\procedure field() modified

\procedure sentence() This tiddler was last $(field)$ on ${[{!!modified}format:date[DDth MMM YYYY]]}$

<$text text={{{ [<sentence>substitute[]] }}}/>

---

<$text text=`This tiddler was last $(field)$ on ${[{!!modified}format:date[DDth MMM YYYY]]}$`/>

That renders as:

This tiddler was last modified on 21st October 2025
This tiddler was last modified on 21st October 2025