tripleDecrypted = {
const startgrouprgx = /(\d{1,2})\(\(3000\)([a-z])(\d+)\)/g
const grouprgx = /\(\(3000\)([a-z])(\d+)\)/g
const startgroups = new Map()
const endgroups = new Map()
let matches
while((matches = startgrouprgx.exec(doubleDecrypted)) !== null) {
startgroups.set(matches[0].replace(/\(/g,'\\(').replace(/\)/g,'\\)'),{char: matches[2].toUpperCase(), spaces: Number(matches[3]), linenum: matches[1] })
}
const startgroupKeys = Array.from(startgroups.keys())
const startgroupsreplaced = startgroupKeys.reduce((str, key) => {
console.log('key:', key)
const group = startgroups.get(key)
console.log('group:', group)
const keyrgx = new RegExp(key, 'g')
const {linenum} = group
const spaces = sequence(group.spaces, _ => ' ').join('')
const char = String.fromCharCode(group.char.charCodeAt(0) + 3)
const replaceWith = `${spaces}${char}`
const newstr = str.replace(keyrgx, `${linenum}:${spaces}${char}`)
console.log(newstr)
return newstr
}, doubleDecrypted)
while((matches = grouprgx.exec(doubleDecrypted)) !== null) {
endgroups.set(matches[0].replace(/\(/g,'\\(').replace(/\)/g,'\\)'),{char: matches[1].toUpperCase(), spaces: Number(matches[2]) })
}
const endgroupKeys = Array.from(endgroups.keys())
const endgroupsreplaced = endgroupKeys.reduce((str, key) => {
console.log('key:', key)
const group = endgroups.get(key)
console.log('group:', group)
const keyrgx = new RegExp(key, 'g')
const spaces = sequence(group.spaces, _ => ' ').join('')
const char = String.fromCharCode(group.char.charCodeAt(0) + 3)
const replaceWith = `${spaces}${char}`
const newstr = str.replace(keyrgx, `${char}${spaces}`)
console.log(newstr)
return newstr
}, startgroupsreplaced)
return endgroupsreplaced.replace(/3000/g,' ')
}