I am processing a substantially large amount of data which contains things containing nested {{}} that are completely irrevelant to me. All I need to do is find them and remove them, only I need to do this several billion times on arbitrarily large (did I mention large?) strings. The following works flawlessly:
my (@array) = $text=~m/( \{\{ (?: [^\{\}]* | (?1) )* \}\} )/xg; $text=~s/\Q$_\E/ / foreach @array;
...up until a certain point at which, I imagine, the machine runs out of memory since it is memoizing this regex. The problem with that is that the things in {{}} occur so infrequently that memoization is actually hurting here, not helping.
Is there conceivably a more efficient way to do this? Please tell me there is and I've been going about Googling for it the wrong way. :)
TIA, DMNIn reply to Efficient way to match and replace nested braces (etc.) by dmn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |