TextSelection::ReplacePattern Method (String^, String^, Int32, TextRanges^)

 

Replaces matching text throughout an entire text document.

Namespace:   EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

bool ReplacePattern(
	String^ Pattern,
	String^ Replace,
	int vsFindOptionsValue = 0,
	TextRanges^% Tags = null
)

Parameters

Pattern
Type: System::String^

Required. The string to find.

Replace
Type: System::String^

Required. The text to replace each occurrence of Pattern.

vsFindOptionsValue
Type: System::Int32

Optional. A vsFindOptions constant indicating the behavior of ReplacePattern, such as how to search, where to begin the search, whether to search forward or backward, and the case sensitivity.

Tags
Type: EnvDTE::TextRanges^

Optional. A TextRanges collection. If the matched text pattern is a regular expression and contains tagged subexpressions, then Tags contains a collection of EditPoint objects, one for each tagged subexpression.

Return Value

Type: System::Boolean

A Boolean value.

ReplacePattern for the TextDocument object replaces text like ReplacePattern for the TextSelection object, but it operates on the whole text document rather than just the text selection.

The ReplacePattern method for Visual Studio is incompatible with earlier versions of the ReplacePattern method, because regular expressions now have a different syntax.

No code example is currently available or this language may not be supported.
Return to top
Show: