I have a pattern @@{}
and given a string I need to find out all the strings coming in 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 goes as :
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 output which I am getting is
@@{first}
@@{second}
@@{third}
Please guide me how to get the desired output and what mistake I am doing