Meaning that I simply want to strip the enclosing braces. I can match "{ this kind of stuff }" with:
"{stuff}".match(/{([^}]*)}/)[1]
Am I asking too much here?
Another example, I've got this javascript code as string:
{
var foo = {
bar: 1
};
var foo2 = {
bar: 2
};
}
I want to strip only the outside braces:
var foo = {
bar: 1
};
var foo2 = {
bar: 2
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…