I used two time from java Pattern to get a specific value. It work fine in first one but not in second.
my code
public static void main(String[] args) throws IOException {
final String path = "E://farhad.txt";
FileReader fr = new FileReader(path);
BufferedReader br = new BufferedReader(fr);
String line;
Pattern pattern = Pattern.compile("\\bCBM_Component_", Pattern.CASE_INSENSITIVE);
while ((line = br.readLine()) != null) {
Matcher matcher = pattern.matcher(line);
String[] splitArray = new String[3];
while (matcher.find()) {
int i = 0;
for (String retval : line.split("\"", 3)) {
splitArray[i] = retval;
i++;
}
System.out.println("CBM name: " + splitArray[1]);
System.out.println("CBM number: " + splitArray[2].substring(2, splitArray[2].length() - 1));
line = br.readLine();
pattern = Pattern.compile("\\bAccountability:\\b", Pattern.CASE_INSENSITIVE);
matcher = pattern.matcher(line);
while (!matcher.find()) {
line = br.readLine();
}
}
}
fr.close();
}
}
my document
View of the Model "CBM_Component_Account Reconciliation" (CBP10609)
===================================================================
CBM Component
Accountability: Execute
Control Element: Accounting Entity to Accounting Entity
Relationship
from first pattern (CBM_Component_
) it work fine but in second one (Accountability:
) it doesn't do any thing.
what I have to do.
thank you