| 1 | <div id="regex_editor_template"> |
| 2 | <div class="regex_editor"> |
| 3 | <h3 class="flex-container justifyCenter alignItemsBaseline"> |
| 4 | <strong data-i18n="Regex Editor">Regex Editor</strong> |
| 5 | <a href="https://docs.sillytavern.app/extensions/regex/" class="notes-link" target="_blank" rel="noopener noreferrer"> |
| 6 | <span class="note-link-span">?</span> |
| 7 | </a> |
| 8 | <div id="regex_test_mode_toggle" class="menu_button menu_button_icon"> |
| 9 | <i class="fa-solid fa-bug fa-sm"></i> |
| 10 | <span class="menu_button_text" data-i18n="Test Mode">Test Mode</span> |
| 11 | </div> |
| 12 | </h3> |
| 13 | |
| 14 | <small class="flex-container extensions_info" data-i18n="ext_regex_desc"> |
| 15 | Regex is a tool to find/replace strings using regular expressions. If you want to learn more, click on the ? next to the title. |
| 16 | </small> |
| 17 | <hr /> |
| 18 | |
| 19 | <div id="regex_info_block_wrapper"> |
| 20 | <div id="regex_info_block" class="info-block"></div> |
| 21 | <a id="regex_info_block_flags_hint" href="https://docs.sillytavern.app/extensions/regex/#flags" target="_blank" rel="noopener noreferrer"> |
| 22 | <i class="fa-solid fa-circle-info" data-i18n="[title]ext_regex_flags_help" title="Click here to learn more about regex flags."></i> |
| 23 | </a> |
| 24 | </div> |
| 25 | |
| 26 | <div id="regex_test_mode" class="flex1 flex-container displayNone"> |
| 27 | <div class="flex1"> |
| 28 | <label class="title_restorable" for="regex_test_input"> |
| 29 | <small data-i18n="Input">Input</small> |
| 30 | </label> |
| 31 | <textarea id="regex_test_input" class="text_pole textarea_compact" rows="4" data-i18n="[placeholder]ext_regex_test_input_placeholder" placeholder="Type here..."></textarea> |
| 32 | </div> |
| 33 | <div class="flex1"> |
| 34 | <label class="title_restorable" for="regex_test_output"> |
| 35 | <small data-i18n="Output">Output</small> |
| 36 | </label> |
| 37 | <textarea id="regex_test_output" class="text_pole textarea_compact" rows="4" data-i18n="[placeholder]ext_regex_output_placeholder" placeholder="Empty" readonly></textarea> |
| 38 | </div> |
| 39 | <hr> |
| 40 | </div> |
| 41 | |
| 42 | <div class="flex-container flexFlowColumn"> |
| 43 | <div class="flex1"> |
| 44 | <label for="regex_script_name" class="title_restorable"> |
| 45 | <small data-i18n="Script Name">Script Name</small> |
| 46 | </label> |
| 47 | <div> |
| 48 | <input class="regex_script_name text_pole textarea_compact" type="text" /> |
| 49 | </div> |
| 50 | </div> |
| 51 | <div class="flex1"> |
| 52 | <label for="find_regex" class="title_restorable"> |
| 53 | <small data-i18n="Find Regex">Find Regex</small> |
| 54 | </label> |
| 55 | <div> |
| 56 | <input class="find_regex text_pole textarea_compact" type="text" /> |
| 57 | </div> |
| 58 | </div> |
| 59 | <div class="flex1"> |
| 60 | <label for="regex_replace_string" class="title_restorable"> |
| 61 | <small data-i18n="Replace With">Replace With</small> |
| 62 | </label> |
| 63 | <div> |
| 64 | <textarea class="regex_replace_string text_pole wide100p textarea_compact" data-i18n="[placeholder]ext_regex_replace_string_placeholder" placeholder="Use {{match}} to include the matched text from the Find Regex, $1, $2, etc. for numbered capture groups, or $<name> for named capture groups." rows="3"></textarea> |
| 65 | </div> |
| 66 | </div> |
| 67 | <div class="flex1"> |
| 68 | <label for="regex_trim_strings" class="title_restorable"> |
| 69 | <small data-i18n="Trim Out">Trim Out</small> |
| 70 | </label> |
| 71 | <div> |
| 72 | <textarea class="regex_trim_strings text_pole wide100p textarea_compact" data-i18n="[placeholder]ext_regex_trim_placeholder" placeholder="Globally trims any unwanted parts from a regex match before replacement. Separate each element by an enter." rows="3"></textarea> |
| 73 | </div> |
| 74 | </div> |
| 75 | </div> |
| 76 | |
| 77 | <div class="flex-container"> |
| 78 | <div class="flex1 wi-enter-footer-text flex-container flexFlowColumn flexNoGap alignitemsstart"> |
| 79 | <small data-i18n="ext_regex_affects">Affects</small> |
| 80 | <div data-i18n="[title]ext_regex_user_input_desc" title="Messages sent by the user."> |
| 81 | <label class="checkbox flex-container"> |
| 82 | <input type="checkbox" name="replace_position" value="1"> |
| 83 | <span data-i18n="ext_regex_user_input">User Input</span> |
| 84 | </label> |
| 85 | </div> |
| 86 | <div data-i18n="[title]ext_regex_ai_input_desc" title="Messages received from the Generation API."> |
| 87 | <label class="checkbox flex-container"> |
| 88 | <input type="checkbox" name="replace_position" value="2"> |
| 89 | <span data-i18n="ext_regex_ai_output">AI Output</span> |
| 90 | </label> |
| 91 | </div> |
| 92 | <div data-i18n="[title]ext_regex_slash_desc" title="Messages sent using STscript commands."> |
| 93 | <label class="checkbox flex-container"> |
| 94 | <input type="checkbox" name="replace_position" value="3"> |
| 95 | <span data-i18n="Slash Commands">Slash Commands</span> |
| 96 | </label> |
| 97 | </div> |
| 98 | <div data-i18n="[title]ext_regex_wi_desc" title="Lorebook/World Info entry contents. Requires 'Only Format Prompt' to be checked!"> |
| 99 | <label class="checkbox flex-container"> |
| 100 | <input type="checkbox" name="replace_position" value="5"> |
| 101 | <span data-i18n="World Info">World Info</span> |
| 102 | </label> |
| 103 | </div> |
| 104 | <div data-i18n="[title]ext_regex_reasoning_desc" title="Reasoning block contents. When 'Only Format Prompt' is checked, it will also affect the reasoning contents added to the prompt."> |
| 105 | <label class="checkbox flex-container"> |
| 106 | <input type="checkbox" name="replace_position" value="6"> |
| 107 | <span data-i18n="Reasoning">Reasoning</span> |
| 108 | </label> |
| 109 | </div> |
| 110 | <div class="flex-container wide100p marginTop5"> |
| 111 | <div class="flex1 flex-container flexNoGap"> |
| 112 | <small data-i18n="[title]ext_regex_min_depth_desc" title="When applied to prompts or display, only affect messages that are at least N levels deep. 0 = last message, 1 = penultimate message, etc. System prompt and utility prompts are not affected. When blank / 'Unlimited' or -1, also affect message to continue on Continue."> |
| 113 | <span data-i18n="Min Depth">Min Depth</span> |
| 114 | <span class="fa-solid fa-circle-question note-link-span"></span> |
| 115 | </small> |
| 116 | <input name="min_depth" class="text_pole textarea_compact" type="number" min="-1" max="9999" data-i18n="[placeholder]ext_regex_min_depth_placeholder" placeholder="Unlimited" /> |
| 117 | </div> |
| 118 | <div class="flex1 flex-container flexNoGap"> |
| 119 | <small data-i18n="[title]ext_regex_max_depth_desc" title="When applied to prompts or display, only affect messages no more than N levels deep. 0 = last message, 1 = penultimate message, etc. System prompt and utility prompts are not affected. Max must be greater than Min for regex to apply."> |
| 120 | <span data-i18n="Max Depth">Max Depth</span> |
| 121 | <span class="fa-solid fa-circle-question note-link-span"></span> |
| 122 | </small> |
| 123 | <input name="max_depth" class="text_pole textarea_compact" type="number" min="0" max="9999" data-i18n="[placeholder]ext_regex_min_depth_placeholder" placeholder="Unlimited" /> |
| 124 | </div> |
| 125 | </div> |
| 126 | </div> |
| 127 | <div class="flex1 wi-enter-footer-text flex-container flexFlowColumn flexNoGap alignitemsstart"> |
| 128 | <small data-i18n="ext_regex_other_options">Other Options</small> |
| 129 | <label class="checkbox flex-container"> |
| 130 | <input type="checkbox" name="disabled" /> |
| 131 | <span data-i18n="Disabled">Disabled</span> |
| 132 | </label> |
| 133 | <label class="checkbox flex-container" data-i18n="[title]ext_regex_run_on_edit_desc" title="Run the regex script when the message belonging a to specified role(s) is edited."> |
| 134 | <input type="checkbox" name="run_on_edit" /> |
| 135 | <span data-i18n="Run On Edit">Run On Edit</span> |
| 136 | </label> |
| 137 | <label class="checkbox flex-container flexNoGap marginBot5" data-i18n="[title]ext_regex_substitute_regex_desc" title="Substitute {{macros}} in Find Regex before running it"> |
| 138 | <span> |
| 139 | <small data-i18n="Macro in Find Regex">Macros in Find Regex</small> |
| 140 | <span class="fa-solid fa-circle-question note-link-span"></span> |
| 141 | </span> |
| 142 | <select name="substitute_regex" class="text_pole textarea_compact margin0"> |
| 143 | <option value="0" data-i18n="Don't substitute">Don't substitute</option> |
| 144 | <option value="1" data-i18n="Substitute (raw)">Substitute (raw)</option> |
| 145 | <option value="2" data-i18n="Substitute (escaped)">Substitute (escaped)</option> |
| 146 | </select> |
| 147 | </label> |
| 148 | <span> |
| 149 | <small data-i18n="Ephemerality">Ephemerality</small> |
| 150 | <span class="fa-solid fa-circle-question note-link-span" data-i18n="[title]ext_regex_other_options_desc" title="By default, regex scripts alter the chat file directly and irreversibly. Enabling either (or both) of the options below will prevent chat file alteration, while still altering the specified item(s)."></span> |
| 151 | </span> |
| 152 | <label class="checkbox flex-container" data-i18n="[title]ext_regex_only_format_visual_desc" title="Chat history file contents won't change, but regex will be applied to the messages displayed in the Chat UI."> |
| 153 | <input type="checkbox" name="only_format_display" /> |
| 154 | <span data-i18n="Only Format Display">Alter Chat Display</span> |
| 155 | </label> |
| 156 | <label class="checkbox flex-container" data-i18n="[title]ext_regex_only_format_prompt_desc" title="Chat history file contents won't change, but regex will be applied to the outgoing prompt before it is sent to the LLM."> |
| 157 | <input type="checkbox" name="only_format_prompt" /> |
| 158 | <span data-i18n="Only Format Prompt (?)">Alter Outgoing Prompt</span> |
| 159 | </label> |
| 160 | |
| 161 | </div> |
| 162 | </div> |
| 163 | </div> |
| 164 | </div> |