I am not familiar with Patterns & matchers, and I am pretty stuck with this problem.
I have a string that I would like to manipulate in Java. I understand that I have to use
Pattern p = Pattern.compile("\\[(.*?)\\]");
Matcher m = p.matcher(in);
while(m.find()) {
String found = m.group(1).toString();
}
But in my string, let's say I have the following examples:
String in = "test anything goes here [A#1234|567]"; //OR
String in = "test anything goes here [B#1234|567]"; //OR
String in = "test anything goes here [C#1234|567]";
I want to find [A# | ] or [B# | ] or [C# | ] in the string, how do I use the regex to find the expression?
|also, along with spaces?