📅  最后修改于: 2022-03-11 15:02:59.444000             🧑  作者: Mango
function getParams(input){
var matches = [];
input.replace(/(\{+)([^}]+)(}+)/g,function(orig,lb,txt,rb){
if (lb.length === rb.length)
matches.push(txt);
});
return matches;
}
var string = "{{foo}} and {{{bar}}} and {{{{hahahaahahahahahaha}}}}";
document.write(getParams(string));