나는 @@{}
패턴을 가지며 중괄호 사이에 오는 모든 문자열을 알아야합니다.주어진 문자열의 패턴을 일치 시켜서 문자열 배열 얻기
예 :
first
second
third
이것에 대한
내 자바 코드로 간다 :
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());
}
내 문자열 Hi This is @@{first} and second is @@{second} along with third @@{third} string
경우 내가 예상 출력 요소로 구성된 문자열 배열입니다 하지만 내가 얻는 결과는
입니다.내가 match.group(1)
에
그런데 이전 질문을 보면 ... 대답이 문제를 해결하는 경우 왼쪽의 녹색 체크 표시를 선택하여 "수락"으로 표시하는 것을 잊지 마십시오. – Jonik
+1 매우 명확하게 쓰여진 질문 –