TextReplace: allow replacing with nothing (#1933)
This commit is contained in:
parent
d5c58ab2b3
commit
0d6bb35075
|
@ -213,7 +213,7 @@ function applyRules(content: string): string {
|
||||||
|
|
||||||
if (stringRules) {
|
if (stringRules) {
|
||||||
for (const rule of stringRules) {
|
for (const rule of stringRules) {
|
||||||
if (!rule.find || !rule.replace) continue;
|
if (!rule.find) continue;
|
||||||
if (rule.onlyIfIncludes && !content.includes(rule.onlyIfIncludes)) continue;
|
if (rule.onlyIfIncludes && !content.includes(rule.onlyIfIncludes)) continue;
|
||||||
|
|
||||||
content = ` ${content} `.replaceAll(rule.find, rule.replace.replaceAll("\\n", "\n")).replace(/^\s|\s$/g, "");
|
content = ` ${content} `.replaceAll(rule.find, rule.replace.replaceAll("\\n", "\n")).replace(/^\s|\s$/g, "");
|
||||||
|
@ -222,7 +222,7 @@ function applyRules(content: string): string {
|
||||||
|
|
||||||
if (regexRules) {
|
if (regexRules) {
|
||||||
for (const rule of regexRules) {
|
for (const rule of regexRules) {
|
||||||
if (!rule.find || !rule.replace) continue;
|
if (!rule.find) continue;
|
||||||
if (rule.onlyIfIncludes && !content.includes(rule.onlyIfIncludes)) continue;
|
if (rule.onlyIfIncludes && !content.includes(rule.onlyIfIncludes)) continue;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue