i understand that
1)there is a new line after every A_2CELNG_1:-aaaaaaaaaaaaaaaadasd44aaaaaaaaaaaa etc
2)in the first string/line you have(1:-) :- instead of ":space" so can i conside either - or space can come
this is the code...first part is regex and inside the while loop as you dont want the whole value i am passing a substring from the first occurence of ":" + 2 till end....
you can give me more inputs with expected outputs if it doesnt help.
String str = var1[0];
// Pattern p = Pattern.compile("\\b([X][A-Z]{2}[0-9][:][0-9]{3})\\b");
Pattern p = Pattern.compile("([A-Z][_][0-9][A-Z]{5}[_][0-9][:][ -][a-zA-Z0-9]*)");
Matcher m = p.matcher(str);
while (m.find()) {
String s = m.group(1);
String filter = s.substring(s.indexOf(":")+2, s.length());
result.addValue(filter);
}
//java.util.regex.Pattern
//java.util.regex.*
//the limitation is in a case
/*
A_2CELNG_1:-aaaaaaaaaaaaaaaaA_2CELNG_2: 34343eee
when theres no separation between the two tokens it doesnt discriminate because it needs something to separate either a space or a new line.
Image may be NSFW.
Clik here to view.
*/