main
Haoming 2026-04-07 14:35:36 +08:00
parent e933ae0fb2
commit 33b9886431
2 changed files with 9 additions and 1 deletions

View File

@ -57,3 +57,6 @@ Sometimes, when you type too fast or copy prompts from all over the places, you
``` ```
- When you type `girl`, it will get converted into `1girl` - When you type `girl`, it will get converted into `1girl`
- Which will get removed if the prompt already contains `1girl` - Which will get removed if the prompt already contains `1girl`
> [!Note]
> The pattern will be wrapped in `^(regex)$`

View File

@ -69,10 +69,15 @@ class pfConfigs {
for (const line of config.split("\n")) { for (const line of config.split("\n")) {
const [tag, words] = line.split(":"); const [tag, words] = line.split(":");
const pattern = new RegExp(words); const pattern = this.#parseRegExp(words);
alias.set(pattern, tag); alias.set(pattern, tag);
} }
return alias; return alias;
} }
/** @param {string} input @returns {RegExp} */
static #parseRegExp(input) {
return new RegExp(`^(${input})$`);
}
} }