in reply to $1[
That's your original expression with extra whitespace.s/ \) ([^()]+) \( / ] $1 [ /xg;
I personally don't see the value in reducing your character count by 2 by avoiding the backslashes in the first place, but this type of process is always susceptible to Leaning_toothpick_syndrome. If I'm doing something like this, with potential nesting and the like, I always build a tree using tokens. My experience has generally shown that in these scenarios the fast solution is never actually fast.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.