I am trying to extract specific characters from string. I have tried using Split and replace to get data. But any other alternative is there to extract? Following is input string
Input1-
q={!tag=tagForType}(Type:(ABC))
Input2-
q={!tag=tagForType}(Type:(ABC OR XYZ))
Output required in list format.
Output1- List1{ABC}
Output2- List1{ABC ,XYZ)
Following is code I have tried to extract such data
if (s.contains("Type")) {
List = s.split("Type:\\(");
String s1 = List[1].replaceAll("\\W", "");
List1 = s1.split("OR");
}
Any other alternative?
Stringtype.java?