Fix more than 9 regex groups

This commit is contained in:
Cohee 2024-03-21 12:12:22 +02:00
parent 41b6169ea8
commit 176befcf8c
1 changed files with 1 additions and 1 deletions

View File

@ -118,7 +118,7 @@ function runRegexScript(regexScript, rawString, { characterOverride } = {}) {
newString = rawString.replace(findRegex, function(match) { newString = rawString.replace(findRegex, function(match) {
const args = [...arguments]; const args = [...arguments];
const replaceString = regexScript.replaceString.replace(/{{match}}/gi, '$0'); 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 // Get a full match or a capture group
const match = args[Number(num)]; const match = args[Number(num)];