String line = null;
while ((line = reader.readLine()) != null) {
- // A領域に記述がない場合は次の行へ
- Pattern pattern0 = Pattern.compile("^.{6}\\s\\s{5}",
- Pattern.CASE_INSENSITIVE);
- Matcher matcher0 = pattern0.matcher(line);
- boolean match0 = matcher0.matches();
- if (match0) {
- offset = offset + line.length() + 1;
- continue;
- }
-
// 部の記述があった場合
- Pattern pattern = Pattern.compile("^.{6}\\s(.*?DIVISION)\\.",
+ Pattern pattern = Pattern.compile("^.{6}\\s(\\s{0,3}[^\\s].*?DIVISION)\\.",
Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(line);
boolean match = matcher.matches();
}
// 節の記述があった場合
- Pattern pattern2 = Pattern.compile("^.{6}\\s(.*?SECTION)\\.",
+ Pattern pattern2 = Pattern.compile("^.{6}\\s(\\s{0,3}[^\\s].*?SECTION)\\.",
Pattern.CASE_INSENSITIVE);
Matcher matcher2 = pattern2.matcher(line);
boolean match2 = matcher2.matches();
}
// その他
- Pattern pattern3 = Pattern.compile("^.{6}\\s(.*)",
+ Pattern pattern3 = Pattern.compile("^.{6}\\s(\\s{0,3}[^\\s].*)",
Pattern.CASE_INSENSITIVE);
Matcher matcher3 = pattern3.matcher(line);
boolean match3 = matcher3.matches();