이 문자열이 있고 HTML 태그없이 실제 이메일이 포함 된 섹션 만 가져오고 싶습니다. (이 줄)로 표시
Content-Type: multipart/alternative; boundary=001a11391134f9593b05083dbd67
X-Antivirus: avast! (VPS 141119-1, 19/11/2014), Inbound message
X-Antivirus-Status: Clean
--001a11391134f9593b05083dbd67
Content-Type: text/plain; charset=UTF-8
(this lines) lorem ipsum (this lines)
(this lines) dolor sit amet (this lines)
--001a11391134f9593b05083dbd67
Content-Type: text/html; charset=UTF-8
<div dir="ltr">lorem ipsum dolor sit amet</div>
--001a11391134f9593b05083dbd67--
.
정규식이 ^ Content-Type : text / plain. *.? $ (두 개의 "-"를 찾을 때까지) 와 비슷하다고 생각 하지만 어떻게해야할지 모르겠습니다.
감사합니다!
내 의견에 제공 한 표현을 가지고 놀았 지만 캡처하지 않는 그룹이 여전히 경기에 포함되는 것처럼 보입니다.
Dim match As Match = Regex.Match(input, "(Content-Type: text/plain; charset=UTF-8\s+)((?!\s+--).|\n)*")
Dim result As String = match.Groups(0).Value.Replace(match.Groups(1).Value, "")
안타깝게도 직선형 일치만큼 깨끗하지는 않지만 찾고있는 결과를 반환해야합니다. 예제와 같이 왼쪽 가장자리 간격을 유지하려면 다음 식을 사용하십시오.
(Content-Type: text/plain; charset=UTF-8)((?!\s+--).|\n)*
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다