What is the most efficient or elegant method for matching brackets in a string such as:
\"f @ g[h[[i[[j[2], k[[1, m[[1, n[2]]]]]]]]]] // z\"
<
Edited (there was an error there)
Is this too naïve?
doubleB[x_String] :=
StringReplace[
ToString@StandardForm@
ToExpression["Hold[" <> x <> "]"],
{"Hold[" -> "", RegularExpression["\]\)$"] -> "\)"}];
doubleB["f[g[h[[i[[j[2], k[[1, m[[1, n[2]]]]]]]]]]]"]
ToExpression@doubleB["f[g[h[[i[[j[2], k[[1, m[[1, n[2]]]]]]]]]]]"]
->

Just trying to exploit Mma's own parser ...