ChatAliases: you can now use $1 or \1 as placeholder var for RegEx

This commit is contained in:
Mirco Wittrien 2018-12-14 22:29:09 +01:00
parent e55e71307b
commit ec0aadbd74
1 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ class ChatAliases {
getDescription () {return "Allows the user to configure their own chat-aliases which will automatically be replaced before the message is being sent.";}
getVersion () {return "1.9.1";}
getVersion () {return "1.9.2";}
getAuthor () {return "DevilBro";}
@ -453,7 +453,7 @@ class ChatAliases {
if (result) {
replaced = true;
let replace = aliasdata.file ? "" : BDFDB.insertNRST(aliasdata.replace);
if (result.length > 1) for (var i = 1; i < result.length; i++) replace = replace.replace(new RegExp("\\\\" + i, "g"), result[i]);
if (result.length > 1) for (var i = 1; i < result.length; i++) replace = replace.replace(new RegExp("\\\\" + i + "|\\$" + i, "g"), result[i]);
tempstring2 += tempstring1.slice(0, result.index + result[0].length).replace(result[0], replace);
tempstring1 = tempstring1.slice(result.index + result[0].length);
if (aliasdata.file && typeof aliasdata.filedata == "string") {