I have String
String myData = "status:\" op en \" AND \"Managed Type\":\"El ectrical\" AND status:verified status:\"resolved\" OR Managed Type:\"Ci vil\"";
I need to distinct all values and attributes from the string.
I have tried one regex with pattern which fulfill requirement as some level , but need help for complex parsing
Pattern pattern = Pattern.compile(
"\\s*[OR|AND]?\\s*(\"?[[\\s*]?\\w*[\\s*]?]*\"?)\\:\"?(([\\s*\\(\\)<>/\\\\\\$\\=\\#\\+%^'`&!{}:;|\\?\\*\\.\\[\\],~@-]?\\w*[\\(\\)<>/\\\\\\$\\=\\#\\+%^'`&!{}:;|\\?\\*\\.\\[\\],~@-]?\\s*)*)\"?\\s*[OR|AND]?\\s*",
Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(mydata);
while (matcher.find()) {
System.out.println(matcher.group(1) + " : " + matcher.group(2));
}
OutPut is like that
status : op en
"Managed Type" : El ectrical
D status : verified status:
" OR Managed Type : Ci vil
Accepted result
status : op en
"Managed Type" : El ectrical
status : verified
status: resolved
Managed Type : Ci vil
Thanks in advance.