Search docs...

Start typing to search documentation

Chat Guide

Regex Scripts

Automatic find-and-replace at four points in the pipeline.

A regex script runs at one of four points:

ModeRuns on
editinputYour message, before it enters the prompt.
editoutputThe model's reply, before it is saved.
editprocessThe whole prompt during assembly.
editdisplayThe rendered message. Storage stays untouched.

Each script is a pattern, a replacement (with $1-style capture references), and flags. Scripts attach to characters, so cards ship their own text pipeline.

editdisplay only changes what you see, never what is stored or sent, so a broken pattern cannot corrupt a chat.

Directives in the script body control execution. An order tag fixes pipeline position when scripts share a mode. Action directives move or transform the match instead of replacing it.

text
<order 10>
@@move_top

Convert asterisk emphasis into markup in the display layer:

text
IN:  \*(.+?)\*
OUT: <em>$1</em>

SillyTavern regex scripts import as part of character cards and run under the same modes.