diff --git a/README.md b/README.md index 8b19e4e..7bcade3 100644 --- a/README.md +++ b/README.md @@ -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` - Which will get removed if the prompt already contains `1girl` + +> [!Note] +> The pattern will be wrapped in `^(regex)$` diff --git a/javascript/pf_configs.js b/javascript/pf_configs.js index bbbfc8c..1e0544a 100644 --- a/javascript/pf_configs.js +++ b/javascript/pf_configs.js @@ -69,10 +69,15 @@ class pfConfigs { for (const line of config.split("\n")) { const [tag, words] = line.split(":"); - const pattern = new RegExp(words); + const pattern = this.#parseRegExp(words); alias.set(pattern, tag); } return alias; } + + /** @param {string} input @returns {RegExp} */ + static #parseRegExp(input) { + return new RegExp(`^(${input})$`); + } }