import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "([가-힣]{2,}.*)\\\\x082[0-9]{7}.*petPtyInfCoVo";
final String string = "\n"
+ "4nW9d7DCkn(\\x010(\\x011\\x0201\\x03신\\x011\\x0820180525\\x03\\x02\\x0f410100012619998D0267\\x0f포메라니안\\x01C\\x03\\n\n\n"
+ "4nXgtZwuDD(\\x010(\\x011\\x0201두부\\x011\\x0820180520\\x03\\x02D0222말티즈 (몰티즈)\\x01C\\x03\\n\n\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\n\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\n\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\n\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\n\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\n\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\n\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\n\n\n\n"
+ "(1) \\\\x0f.*\\*([가-힣]{2,}.*)\\\\x0820\n"
+ "(2)([가-힣]{2,}.*)\\\\x0820.*petPtyInfCoVo\n\n\n"
+ "\\\\x011\\\\x0201.*x0820.*D0.*[가-힣].*\\\\x01.*\\\\x03\n\n"
+ "([가-힣]{2}.[가-힣]{2})\\\\x08.*petPtyInfCoVo\n\n"
+ "\\x0f([가-힣]{2,})\\x08.*petPtyInfCoVo\n\n"
+ "\\\\x0f([가-힣]{2,})\\\\x08.*petPtyInfCoVo\n\n"
+ "([가-힣]{2}.[가-힣]{2})\\\\x08.*petPtyInfCoVo\n\n\n\n"
+ "\\\\x011\\\\x0201.*x0820.*D0.*([가-힣]{2,}).\\(\n\n\n\n\n\n\n"
+ "[0-9a-zA-Z]{10}\\t([A-Z가-힣\\s]{2,})\\n',";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
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 Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html