#!/usr/bin/env perl
use strict;
use warnings;
my $p = '
AAA
//content
:AAA
';
if (
$p =~ /
(?(R)
(?P<tag>ZZZ)
|
(?P<tag>AAA)
)
[^:]+
:(?P=tag)
/mx
){
}
else{
}
IyEvdXNyL2Jpbi9lbnYgcGVybAp1c2Ugc3RyaWN0Owp1c2Ugd2FybmluZ3M7CgoKCm15ICRwID0gJwpBQUEKLy9jb250ZW50CjpBQUEKCic7CgppZiAoCiRwID1+IC8KCig/KFIpCiAgICAoP1A8dGFnPlpaWikgICAgICAgICAgICAgCnwKICAgICg/UDx0YWc+QUFBKQopCgpbXjpdKwoKOig/UD10YWcpCgovbXgKCil7CQoJcHJpbnQgIm9rXG4iOwkKfQplbHNlewoJcHJpbnQgIm9vcHNcbiI7Cn0KCg==