중간을 변경할 수있는 문자열의 시작과 끝을 일치시키는 데 사용하려고하는 아래 코드가 있습니다. 나는이 예제를 작동 시키려면 먼저이 코드로 에러를 알려주고 전혀 일치하지 않는 이유를 알려 주려고 노력하고있다. 문제의 문자열의 중간 부분이 변경 될 경우Regex가 문자열과 일치하지 않습니다.
string pattern = @"/\/>[^<]*abc/";
string text = @"<foo/> hello first abc hello second abc <bar/> hello third abc";
Regex r = new Regex(pattern, RegexOptions.IgnoreCase);
Match m = r.Match(text);
캡처하려는거야? 내가 당신의 정규 표현식에서 가져올 확신 모르겠어요. 또한, 필수 [xml/html을 정규식으로 구문 분석하지 마십시오] (http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454) –
새 질문을 즉시 시작하지 마십시오. 귀하의 질문에 이미 답변했습니다. – markijbema