---
title: "Discussion on \"SillyTavern regex: a display-only text cleanup recipe\" | Hashnode"
description: "Discussion on \"SillyTavern regex: a display-only text cleanup recipe\". Remove a literal line prefix with one small regex, inspect tested examples and nonmatches, and separate display cleanup from prompts and saved chat history."
url: "https://hashnode.com/posts/sillytavern-regex-display-cleanup/6aff9c8a6f397165ae769df6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [SillyTavern regex: a display-only text cleanup recipe](https://blog.echomelon.com/sillytavern-regex-display-cleanup?utm_source=hashnode&utm_medium=feed)

Remove a literal line prefix with one small regex, inspect tested examples and nonmatches, and separate display cleanup from prompts and saved chat history.

1d ago · 5 min read · blog.echomelon.com  
Read the article

-   [#artificial-intelligence](https://hashnode.com/tag/artificial-intelligence)
-   [#tutorial](https://hashnode.com/tag/tutorial)

## Written by

[echomelon](https://hashnode.com/@echomelon)

@echomelon

  
[View profile](https://hashnode.com/@echomelon)

## Responses 1

Markdown supported · ⌘↵ to post

[QRiQRa Team](https://hashnode.com/@qriqra)

[1d ago](https://hashnode.com/posts/sillytavern-regex-display-cleanup/6aff9c8a6f397165ae769df6/comment/6affcc91756d56fb3041f5d0)

The useful split is between a display-only rule and one that rewrites the stored file. The recipe is narrow on purpose: it removes a literal \[Scene\] at the start of a line, plus the spaces or tabs that follow, and leaves the rest of the sentence. Using only horizontal whitespace, rather than a broader whitespace class, is the detail that keeps a line that was only the label from collapsing into its neighbors. The cases that stay unchanged — a mention inside a sentence, different capitalization, or a space before the bracket — also make sense once the intent is this exact prefix, not anything that looks similar. One pass leaving a second prefix on the same line is a fair limit to state up front.
