yjxh90

yjxh90:

------------------------------------------

String str = FileUtils.readFileToString(new File("d:/1.txt"));
       
String reg = "^ZCZC\\s*[\\n|\\r]YJXH90\\s+[A-Z]{4}\\s+\\d{6}\\s*[\\n\\r]\\d{12}\\s+[A-Z]{4}\\s+([A-Z]\\d{4}\\s*){1,}=[\\n|\\r]\\s*NNNN$";
       
System.out.println(Pattern.matches(reg, str));

------------------------------------------

 

未转义:

"^ZCZC\s*[\n|\r]YJXH90\s+[A-Z]{4}\s+\d{6}\s*[\n\r]\d{12}\s+[A-Z]{4}\s+([A-Z]\d{4}\s*){1,}=[\n|\r]\s*NNNN$"

 

本文出自 “小萨” 博客,谢绝转载!

你可能感兴趣的:(regex)