bare-script 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/library.js +4 -1
- package/package.json +1 -1
package/lib/library.js
CHANGED
|
@@ -888,7 +888,10 @@ function regexReplace([regex, string, substr]) {
|
|
|
888
888
|
return null;
|
|
889
889
|
}
|
|
890
890
|
|
|
891
|
-
|
|
891
|
+
// Re-compile the regex with the "g" flag, if necessary
|
|
892
|
+
const regexGlobal = (regex.flags.indexOf('g') !== -1 ? regex : new RegExp(regex.source, `${regex.flags}g`));
|
|
893
|
+
|
|
894
|
+
return string.replaceAll(regexGlobal, substr);
|
|
892
895
|
}
|
|
893
896
|
|
|
894
897
|
|