1
나는 정규 표현식를 사용하여 문자열의를 수집 {값을} 싶어.추출 값은
가 lorem ipsum의 {필드 1}가 lorem ipsum의 {FIELD2} 로렘 입숨 필드 1 로렘 입숨 FIELD2 {{FIELD3}}
내가 얻을 것 : {field1} and {field2}
I 예를 들어
이것을 시도하십시오 :
string pattern [email protected]"\[(?>[^\{\}]+)*\]";
MatchCollection matches = Regex.Matches(text, pattern);
for (int ctr = 0; ctr < matches.Count; ctr++)
{
string field = matches[ctr].Value;
// ... ommitted...
}
어떤 제안이 있습니까?
'{val1}}'및 '{{val2}'와 같은 값을 일치 시키려면 다음과 같이 바꾸어야합니다.'(?