I'd like to create a regular expression that is able to fetch every loop inside a brainfuck code.
Let's say this code is given:
\[ - Match the first (opening) bracket
[-+><.,\[\]]* - followed by a number of brainfuck operators
] - followed by a closing bracket
I had written this one once when I needed to match a pair of square brackets (while handling nesting correctly)
It is a .NET regex that uses some features that aren't available in all regex engines. Here goes: