I have a @@{} pattern and I need a string, I need to find out all the lines between the curly braces.
Example: If my string is Hi This is @@{first} and second is @@{second} along with third @@{third} string
The output I expect is a string array consisting of elements:
first second third
My Java code for this is as follows:
Pattern p = Pattern.compile("\\@\\@\\{(.+?)\\}"); Matcher match = p.matcher("Hi This is @@{first} and second is @@{second} along" + "with third @@{third} string"); while(match.find()) { System.out.println(match.group()); }
But the conclusion that I get is
@@{first} @@{second} @@{third}
Tell me how to get the desired result and what mistake I am making.
source share