다음을 통해 공유


EditPoint2.ReplacePattern 메서드 (TextPoint, String, String, Int32, TextRanges%)

지정한 텍스트 범위에서 패턴을 찾아서 지정한 텍스트로 바꿉니다.

네임스페이스:  EnvDTE80
어셈블리:  EnvDTE80(EnvDTE80.dll)

구문

‘선언
Function ReplacePattern ( _
    Point As TextPoint, _
    Pattern As String, _
    Replace As String, _
    vsFindOptionsValue As Integer, _
    <OutAttribute> ByRef Tags As TextRanges _
) As Boolean
bool ReplacePattern(
    TextPoint Point,
    string Pattern,
    string Replace,
    int vsFindOptionsValue,
    out TextRanges Tags
)
bool ReplacePattern(
    [InAttribute] TextPoint^ Point, 
    [InAttribute] String^ Pattern, 
    [InAttribute] String^ Replace, 
    [InAttribute] int vsFindOptionsValue, 
    [InAttribute] [OutAttribute] TextRanges^% Tags
)
abstract ReplacePattern : 
        Point:TextPoint * 
        Pattern:string * 
        Replace:string * 
        vsFindOptionsValue:int * 
        Tags:TextRanges byref -> bool 
function ReplacePattern(
    Point : TextPoint, 
    Pattern : String, 
    Replace : String, 
    vsFindOptionsValue : int, 
    Tags : TextRanges
) : boolean

매개 변수

  • Point
    형식: EnvDTE.TextPoint
    필수적 요소로서,지정한 텍스트 범위의 끝 지점입니다.편집 지점에서 Point 범위까지 바뀝니다.
  • Pattern
    형식: System.String
    필수적 요소로서,찾을 문자열입니다.
  • Replace
    형식: System.String
    필수적 요소로서,Pattern 대신 사용할 문자열입니다.
  • vsFindOptionsValue
    형식: System.Int32
    선택적 요소로서,수행할 검색 형식을 나타내는 vsFindOptions 상수입니다.
  • Tags
    형식: EnvDTE.TextRanges%
    선택적 요소로서,일치하는 패턴이 정규식이고 태그가 지정된 부분식을 포함하는 경우 Tags는 태그가 지정된 각 부분식마다 하나씩 TextRange 개체의 컬렉션을 포함합니다.

반환 값

형식: System.Boolean
대체 작업이 성공적으로 수행되면 true이고, 그렇지 않으면 false입니다.

구현

EditPoint.ReplacePattern(TextPoint, String, String, Int32, TextRanges%)

설명

ReplacePattern은 편집 지점과 인수 Point 사이의 텍스트만 검색한다는 점을 제외하고는 FindPattern과 비슷하게 텍스트를 찾습니다. 문서 전체에서 텍스트를 찾아 바꾸려면 TextDocument.ReplacePattern을 사용합니다. Tags 컬렉션은 일치하는 마지막 패턴에 대한 정보만 반환합니다.

예제

Sub ReplacePatternExample()
   Dim objTextDoc As TextDocument
   Dim objMovePt As EditPoint
   Dim objEditPt As EditPoint, iCtr As Integer

   ' Create a new text file.
   DTE.ItemOperations.NewFile("General\Text File")

   ' Get a handle to the new document and create an EditPoint.
   objTextDoc = DTE.ActiveDocument.Object("TextDocument")
   objMovePt = objTextDoc.EndPoint.CreateEditPoint
   objEditPt = objTextDoc.StartPoint.CreateEditPoint

   ' Insert ten lines of text.
   For iCtr = 1 To 10
      objEditPt.Insert("This is a test." & Chr(13))
   Next iCtr
   objEditPt.StartOfDocument()
   objMovePt.EndOfDocument()
   ' Replace all occurrences of "test" with "thing."
    objEditPt.ReplacePattern(objMovePt, "test", "thing", vsFindOptions.vsFindOptionsFromStart)
End Sub

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

EditPoint2 인터페이스

ReplacePattern 오버로드

EnvDTE80 네임스페이스