I have a page with much text. I want to find in that page any text which is located between 2 pairs of double braces ( {{}} ) and to move the whole block at the very top of the page. The problem is a bit more complex because the block limited by those double braces may contain other braces and pairs of braces, and in such cases I also need to do the move. It's necessary to capture only the block located between 2 pairs of double braces, including starting and closing pairs of double braces, but optionally may contain other braces (pairs or not, but symmetrical number of opening braces to closing ones).
Example with input text (http://pastebin.com/7JcA7Wku):
Lorem ipsum dolor sit amet...
{{
some text with or without other { } / {{}}, but not odd, only even number of braces
To be captured
}}
... Donec sed scelerisque erat.
Is this possible to do via regex?