How do I find matching/nesting anything?

This isn't something that can be tackled in one regular expression, no matter how complicated. To find something between two single characters, a pattern like /xx/ will get the intervening bits in $1. For multiple ones, then something more like /alphaomega/ would be needed. But none of these deals with nested patterns, nor can they. For that you'll have to write a parser.