lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I am working in an embedded environment and constantly looking for ways to minimize memory use and garbage creation.  In my application we (don't ask me why) quote literal strings with {{}} (two curly brackets).  The pattern I am using to strip these out looks something like:

 

'{(%b{})}'


The problem is I process a lot of these (potentially long) strings, but to actually use them, I need to strip off the {} on the end, meaning I create a temporary string (garbage).

 

My question is this: Is there currently a way to capture what is inside the balanced _expression_, exclusive of the delimiters?  I suppose I could do it by hand (in Lua or C) but I don't really like that idea.

 

I have attempted to modify the lua source to add %B, so I could use the pattern '{(%B{})}'  Unfortunately if the capture is not directly around the %B it won't work.  Maybe if the capture isn't directly around the %B it behaves the same as %b.  Any thoughts?


Dolphin