For example, the input would be:
@[facts.::ip](facts.::ip) = "127.0.0.1" AND @[facts.::os](facts.::os) = "ubuntu"
I would like to transform that into:
facts.::ip = "127.0.0.1" AND facts.::os = "ubuntu"
Thanks in advance!
I have tried to check for regex, but I do not have experience with it
>Solution :
Below regular expression method achieves required string transformation.
let from = '@[facts.::ip](facts.::ip) = "127.0.0.1" AND @[facts.::os](facts.::os) = "ubuntu"';
let to = from.replace(/(@\[([^\]\)]+)\]\(\2\))/g, "$2");
console.log(to);