Do not use implicit regex flag when pattern is regex

As discussed with filter list volunteers.
This commit is contained in:
Raymond Hill 2023-11-10 12:29:51 -05:00
parent 15e3f763a3
commit f68683f988
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 2 additions and 2 deletions

View File

@ -114,7 +114,7 @@ function safeSelf() {
return new RegExp(verbatim ? `^${reStr}$` : reStr, flags);
}
try {
return new RegExp(match[1], match[2] || flags);
return new RegExp(match[1], match[2] || undefined);
}
catch(ex) {
}
@ -563,7 +563,7 @@ function replaceNodeTextFn(
const rePattern = safe.patternToRegex(pattern, 'gms');
const extraArgs = safe.getExtraArgs(Array.from(arguments), 3);
const shouldLog = scriptletGlobals.has('canDebug') && extraArgs.log || 0;
const reCondition = safe.patternToRegex(extraArgs.condition || '', 'gms');
const reCondition = safe.patternToRegex(extraArgs.condition || '', 'ms');
const stop = (takeRecord = true) => {
if ( takeRecord ) {
handleMutations(observer.takeRecords());