Skip to Content

Template Syntax

Expressions are written inside double curly braces: {{expression}}. The behavior depends on whether the entire string is a single expression or contains mixed text and expressions.

Single expression

When the entire string is a single {{expression}}, the return type is preserved β€” it can be a number, boolean, array, object, or string.

{{price * quantity}} β†’ 50 (number) {{age >= 18}} β†’ true (boolean) {{tags}} β†’ ["a","b"] (array) {{old.toUpperCase()}} β†’ "HELLO" (string)

A single expression preserves the original type. This is important β€” {{"{{"}}42{{"}}"}} returns the number 42, not the string "42".

String interpolation

When the template contains text outside of {{...}}, or has multiple expressions, the result is always a string.

Hello {{firstName}}! β†’ "Hello Alice!" {{firstName}} {{lastName}} β†’ "Alice Smith" Total: {{price * quantity}} ({{currency}}) β†’ "Total: 50 (USD)"

Each {{expression}} is evaluated independently, converted to a string, and interpolated into the surrounding text.

Error handling

When an expression fails to evaluate, it produces an error marker in the output:

{{unknownFunction()}} β†’ [ERROR: Not callable] {{a +}} β†’ [ERROR: Invalid expression]

For string interpolation with mixed expressions, only the failing expression is replaced with the error marker β€” the rest of the template still evaluates:

Name: {{firstName}}, Age: {{badExpr()}} β†’ "Name: Alice, Age: [ERROR: Not callable]"

When an expression errors in Find & Replace, the replacement value becomes the error string [ERROR: ...]. Always test your expressions on a small sample first.

No-expression fallback

If a string has no {{...}} templates, it is treated as a plain literal:

hello world β†’ "hello world" (returned as-is) 42 β†’ "42" (string, not number β€” no expression to evaluate)

Escaping

There is currently no escape syntax for literal {{ characters. If you need literal double braces in your output, they will be interpreted as expression delimiters.

Whitespace

Whitespace inside {{ }} is trimmed before evaluation:

{{ firstName }} β†’ same as {{firstName}} {{ price * 2 }} β†’ same as {{price * 2}}
Last updated on