You have changed the requirement to include more complicated loop..endloop constructs. While there may be a regex that can dissect that, perhaps a parser is more what you need. Does your data have a grammar you can feed a parser generator like Parse::RecDescent or (b)yacc?
After Compline,
Zaxo
In reply to Re: more regex help ...
by Zaxo
in thread more regex help ...
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |