> $brackets = qr{ > { > (?: > (?> [^{}]+ | (?p{ $qr }) ) > )* > } > }x; > > [ I will investigate why one cannot drop these (?:). ] I just sent you an example of a regular expression that cores when ?: turns into ?> in the same regex, and an example of the infinite loop problem. > > And probably you want m{\G(?p{ $brackets })}, which would avoid > recompile of the REx. How about m"\G$brackets"o? Is this equivalent? (hope so) > > Come to think of it, perhaps 'all or nothing' is a better term for the operator > > - ie, if something fails to match, the engine rewinds all the way back > > to the beginning, bumps up its position by 1 from the beginning point > > and then starts again. > > Why this cannot be implemented by nested (?>) ? I would hope that it would be. I'd also assume that this would be a good way to describe the regex inside of perlre. > > So matching the above without the \G modifier would look like: > > > > tries '{.... (goes to end without success) > > tries 't' (fails immediately) > > tries 'h' (fails immediately) > > tries 'i' (fails immediately) > > tries 's' (fails immediately) > > tries '{........ slowly } (succeeds.) > > Why do you think it is not doing it like this? Well, like I said, I'd hope so. All I'm doing is making sure that we are talking about the same thing. Describing it this way in perlre would be a good idea, IMO. Mentioning 'use re 'debugcolor';' would be a good idea as well. 'Tis extremely useful... Planning an interface with it and emacs? ;-) Ed