in reply to Plug for an alternate regex engine

As suggested by hv, I got the $^N working. Again you need to know the nesting in advance. This is the $2 & $3 bit:
(?= (??{ qr!.{$a[2][0]}! }) ( # start $2 (?= (??{ qr!.{${\($a[3][0]-$a[2][0])}}! }) + ((??{ qr!.{$a[3][1]}! })) ) # $3 nested (??{ qr!.{$a[2][1]}! }) ) # $2 ended )