use strict;
my $str = '
4nW9d7DCkn(\\x010(\\x011\\x0201\\x03신\\x011\\x0820180525\\x03\\x02\\x0f410100012619998D0267\\x0f포메라니안\\x01C\\x03\\n
4nXgtZwuDD(\\x010(\\x011\\x0201두부\\x011\\x0820180520\\x03\\x02D0222말티즈 (몰티즈)\\x01C\\x03\\n
4nXTTaAcB1(\\x011(\\x011\\x0820210303\\x0820240303\\x1a올드 잉글리시 쉽독\\x0820210303\\x011\\x011\\x011\\x01Y\\x03\\x03\\x01\\x13\\x02\\x01\\x1dbody.petInfCoVo.petPtyInfCoVo\\x10\\x13\\x02\\x1e\\x0bparentIndex\\x02\\x04\\x01\\x08rowIndex\\x02\\x04\\x01ctrId\\x01\\x01\\x01\\tctrPtySeq\\x04\\x0f\\x01hisSeq\\x04\\x0f\\x01\\x08bizSysCd\\x01\\x01\\x01\\x07prctrNo\\x01\\x01\\x01polNo\\x01\\x14\\x01\\n
4nXb4V19kO(\\x011(\\x011\\x0820210311\\x0820240311\\x10비숑 프리제\\x0820210306\\x011\\x011\\x01Y\\x03\\x03\\x01\\x13\\x02\\x01\\x1dbody.petInfCoVo.petPtyInfCoVo\\x10\\x13\\x02\\x1e\\x0bparentIndex\\x02\\x04\\x01\\x08rowIndex\\x02\\x04\\x01ctrId\\x01\\x01\\x01\\tctrPtySeq\\x04\\x0f\\x01hisSeq\\x04\\x0f\\x01\\x08bizSysCd\\x01\\x01\\x01\\x07prctrNo\\x01\\x01\\x01polNo\\x01\\x14\\x01\\n
4nXgtZwk3x(\\x011(\\x011\\x0820210312\\x0820240312말티즈 (몰티즈)\\x0820210312\\x011\\x011\\x01Y\\x03\\x03\\x01\\x13\\x02\\x01\\x1dbody.petInfCoVo.petPtyInfCoVo\\x10\\x13\\x02\\x1e\\x0bparentIndex\\x02\\x04\\x01\\x08rowIndex\\x02\\x04\\x01ctrId\\x01\\x01\\x01\\tctrPtySeq\\x04\\x0f\\x01hisSeq\\x04\\x0f\\x01\\x08bizSysCd\\x01\\x01\\x01\\x07prctrNo\\x01\\x01\\x01polNo\\x01\\x14\\x01\\n
4nXV55LGCp(\\x011(\\x011\\x0820210304\\x0820240304\\x0f포메라니안\\x0820210304\\x011\\x011\\x01Y\\x03\\x03\\x01\\x13\\x02\\x01\\x1dbody.petInfCoVo.petPtyInfCoVo\\x10\\x13\\x02\\x1e\\x0bparentIndex\\x02\\x04\\x01\\x08rowIndex\\x02\\x04\\x01ctrId\\x01\\x01\\x01\\tctrPtySeq\\x04\\x0f\\x01hisSeq\\x04\\x0f\\x01\\x08bizSysCd\\x01\\x01\\x01\\x07prctrNo\\x01\\x01\\x01polNo\\x01\\x14\\x01\\n
4nXnKyeGXv(\\x011(\\x011\\x0820210317\\x0820240317\\x0f410100008154365\'웰시 코기 (펨브록 웰시 코기)\\x0820210316\\x011\\x011\\x011\\x01Y\\x03\\x03\\x01\\x13\\x02\\x01\\x1dbody.petInfCoVo.petPtyInfCoVo\\x10\\x13\\x02\\x1e\\x0bparentIndex\\x02\\x04\\x01\\x08rowIndex\\x02\\x04\\x01ctrId\\x01\\x01\\x01\\tctrPtySeq\\x04\\x0f\\x01hisSeq\\x04\\x0f\\x01\\x08bizSysCd\\x01\\x01\\x01\\x07prctrNo\\x01\\x01\\x01polNo\\x01\\x14\\x01\\n
토이 푸들\\x0820210322\\x011\\x011\\x011\\x01Y\\x03\\x03\\x01\\x13\\x02\\x01\\x1dbody.petInfCoVo.petPtyInfCoVo\\x10\\x13\\x02\\x1e\\x0bparentIndex\\x02\\x04\\x01\\x08rowIndex\\x02\\x04\\x01ctrId\\x01\\x01\\x01\\tctrPtySeq\\x04\\x0f\\x01hisSeq\\x04\\x0f\\x01\\x08bizSysCd\\x01\\x01\\x01\\x07prctrNo\\x01\\x01\\x01polNo\\x01\\x14\\x01\\n
4nXcR06aop(\\x011(\\x011\\x0820210315\\x0820240315\\x0f410100004563767*기타B/믹스견 (5kg 초과 15kg 이하)\\x0820210309\\x011\\x011\\x011\\x01Y\\x03\\x03\\x01\\x13\\x02\\x01\\x1dbody.petInfCoVo.petPtyInfCoVo\\x10\\x13\\x02\\x1e\\x0bparentIndex\\x02\\x04\\x01\\x08rowIndex\\x02\\x04\\x01ctrId\\x01\\x01\\x01\\tctrPtySeq\\x04\\x0f\\x01hisSeq\\x04\\x0f\\x01\\x08bizSysCd\\x01\\x01\\x01\\x07prctrNo\\x01\\x01\\x01polNo\\x01\\x14\\x01\\n
(1) \\\\x0f.*\\*([가-힣]{2,}.*)\\\\x0820
(2)([가-힣]{2,}.*)\\\\x0820.*petPtyInfCoVo
\\\\x011\\\\x0201.*x0820.*D0.*[가-힣].*\\\\x01.*\\\\x03
([가-힣]{2}.[가-힣]{2})\\\\x08.*petPtyInfCoVo
\\x0f([가-힣]{2,})\\x08.*petPtyInfCoVo
\\\\x0f([가-힣]{2,})\\\\x08.*petPtyInfCoVo
([가-힣]{2}.[가-힣]{2})\\\\x08.*petPtyInfCoVo
\\\\x011\\\\x0201.*x0820.*D0.*([가-힣]{2,}).\\(
[0-9a-zA-Z]{10}\\t([A-Z가-힣\\s]{2,})\\n\',';
my $regex = qr/([가-힣]{2,}.*)\\x082[0-9]{7}.*petPtyInfCoVo/mp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html