I don't think that the greedy/non-greedy feature is powerful enough to handle nested tags when you're trying to match the entire expression, including the opening and closing tags. When I was implementing my UBBCode font tag, I experimented with that, and had to resort to using a loop. I think the problem was that the inner tags were getting swallowed. But maybe I didn't try hard enough. Or maybe the more advanced regex features (look-ahead/look-behind assertions) would help.