From c30c571ce7b3ea0926b80cf0af1a61a817e9919b Mon Sep 17 00:00:00 2001 From: Mara Date: Mon, 28 Nov 2022 19:13:07 +0100 Subject: [PATCH] fix(regex): add 'gi' as default flags for regex --- plugin/contents_conversion/findAndReplaceText.ts | 2 +- plugin/settings.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/contents_conversion/findAndReplaceText.ts b/plugin/contents_conversion/findAndReplaceText.ts index 57fe4933..45593260 100644 --- a/plugin/contents_conversion/findAndReplaceText.ts +++ b/plugin/contents_conversion/findAndReplaceText.ts @@ -17,7 +17,7 @@ export default function findAndReplaceText(text: string, settings: GitHubPublish } for (const censor of censoring) { if ((!censor.flags) || (!censor.flags.match(/^[gimsuy\s]+$/))) { - censor.flags = ''; + censor.flags = 'gi'; } const regex = new RegExp(censor.entry, censor.flags); // @ts-ignore diff --git a/plugin/settings.ts b/plugin/settings.ts index a59a1c91..f09c1648 100644 --- a/plugin/settings.ts +++ b/plugin/settings.ts @@ -331,7 +331,7 @@ export class GithubPublisherSettings extends PluginSettingTab { entry: "", replace: "", after: false, - flags: '' + flags: 'gi' }; this.plugin.settings.censorText.push(censorText); await this.plugin.saveSettings();