mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Sometimes a user may want to substitute variables in the regex itself rather than just matching those variables. This can be optionally enabled in the editor. In addition, try preventing crashes by checking for undefined variables or null coalescing. Signed-off-by: kingbri <bdashore3@proton.me>
100 lines
4.4 KiB
HTML
100 lines
4.4 KiB
HTML
<div id="regex_editor_template">
|
|
<div class="regex_editor">
|
|
<h3><strong>Regex Editor</strong></h3>
|
|
|
|
<div class="flex-container flexFlowColumn">
|
|
<div class="flex1">
|
|
<label for="regex_script_name" class="title_restorable">
|
|
<small data-i18n="Script Name">Script Name</small>
|
|
</label>
|
|
<div>
|
|
<input class="regex_script_name text_pole textarea_compact" type="text" />
|
|
</div>
|
|
</div>
|
|
<div class="flex1">
|
|
<label for="find_regex" class="title_restorable">
|
|
<small data-i18n="Find Regex">Find Regex</small>
|
|
</label>
|
|
<div>
|
|
<input class="find_regex text_pole textarea_compact" type="text" />
|
|
</div>
|
|
</div>
|
|
<div class="flex1">
|
|
<label for="regex_replace_string" class="title_restorable">
|
|
<small data-i18n="Replace With">Replace With</small>
|
|
</label>
|
|
<div>
|
|
<textarea
|
|
class="regex_replace_string text_pole wide100p textarea_compact"
|
|
placeholder="Use {{match}} to include the matched text from the Find Regex"
|
|
rows="2"
|
|
></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="flex1">
|
|
<label for="regex_trim_strings" class="title_restorable">
|
|
<small data-i18n="Trim Out">Trim Out</small>
|
|
</label>
|
|
<div>
|
|
<textarea
|
|
class="regex_trim_strings text_pole wide100p textarea_compact"
|
|
placeholder="Globally trims any unwanted parts from a regex match before replacement. Separate each element by an enter."
|
|
rows="3"
|
|
></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex-container">
|
|
<div class="wi-enter-footer-text flex-container flexFlowColumn flexNoGap alignitemsstart">
|
|
<small>Placement</small>
|
|
<div>
|
|
<label class="checkbox flex-container">
|
|
<input type="checkbox" name="replace_position" value="0">
|
|
<span data-i18n="Author's Note">Markdown Display</span>
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<label class="checkbox flex-container">
|
|
<input type="checkbox" name="replace_position" value="1">
|
|
<span data-i18n="Before Char">User Input</span>
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<label class="checkbox flex-container">
|
|
<input type="checkbox" name="replace_position" value="2">
|
|
<span data-i18n="After Char">AI Output</span>
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<label class="checkbox flex-container">
|
|
<input type="checkbox" name="replace_position" value="3">
|
|
<span data-i18n="Author's Note">/sys Command</span>
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<label class="checkbox flex-container">
|
|
<input type="checkbox" name="replace_position" value="4">
|
|
<span data-i18n="Author's Note">/sendas Command</span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div class="wi-enter-footer-text flex-container flexFlowColumn flexNoGap alignitemsstart">
|
|
<small>Other Options</small>
|
|
<label class="checkbox flex-container">
|
|
<input type="checkbox" name="disabled" />
|
|
<span data-i18n="Disabled">Disabled</span>
|
|
</label>
|
|
<label class="checkbox flex-container">
|
|
<input type="checkbox" name="run_on_edit" />
|
|
<span data-i18n="Run On Edit">Run On Edit</span>
|
|
</label>
|
|
<label class="checkbox flex-container">
|
|
<input type="checkbox" name="substitute_regex" />
|
|
<span data-i18n="Substitute Regex">Substitute Regex</span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|