Fix more than 9 regex groups

This commit is contained in:
Cohee 2024-03-21 12:12:22 +02:00
parent 41b6169ea8
commit 176befcf8c

View File

@ -118,7 +118,7 @@ function runRegexScript(regexScript, rawString, { characterOverride } = {}) {
newString = rawString.replace(findRegex, function(match) {
const args = [...arguments];
const replaceString = regexScript.replaceString.replace(/{{match}}/gi, '$0');
const replaceWithGroups = replaceString.replaceAll(/\$(\d)+/g, (_, num) => {
const replaceWithGroups = replaceString.replaceAll(/\$(\d+)/g, (_, num) => {
// Get a full match or a capture group
const match = args[Number(num)];