ITextSearchService2.FindForReplace Method (SnapshotSpan, String, String, FindOptions, String%)
Searches for the next occurrence of the search pattern and returns the result of replacing the search pattern with the replacement pattern.
Namespace: Microsoft.VisualStudio.Text.Operations
Assembly: Microsoft.VisualStudio.Text.Logic (in Microsoft.VisualStudio.Text.Logic.dll)
Syntax
'Declaração
Function FindForReplace ( _
searchRange As SnapshotSpan, _
searchPattern As String, _
replacePattern As String, _
options As FindOptions, _
<OutAttribute> ByRef expandedReplacePattern As String _
) As Nullable(Of SnapshotSpan)
Nullable<SnapshotSpan> FindForReplace(
SnapshotSpan searchRange,
string searchPattern,
string replacePattern,
FindOptions options,
out string expandedReplacePattern
)
Nullable<SnapshotSpan> FindForReplace(
SnapshotSpan searchRange,
String^ searchPattern,
String^ replacePattern,
FindOptions options,
[OutAttribute] String^% expandedReplacePattern
)
abstract FindForReplace :
searchRange:SnapshotSpan *
searchPattern:string *
replacePattern:string *
options:FindOptions *
expandedReplacePattern:string byref -> Nullable<SnapshotSpan>
function FindForReplace(
searchRange : SnapshotSpan,
searchPattern : String,
replacePattern : String,
options : FindOptions,
expandedReplacePattern : String
) : Nullable<SnapshotSpan>
Parameters
- searchRange
Type: Microsoft.VisualStudio.Text.SnapshotSpan
[in] The range of text to search in.
- searchPattern
Type: System.String
[in] The text pattern to search for.
- replacePattern
Type: System.String
[in] The text pattern to replace the found text with.
- options
Type: Microsoft.VisualStudio.Text.Operations.FindOptions
[in] Options to use for the search.
- expandedReplacePattern
Type: System.String%
[out] The result of the replacement. Value is null if no matches are found. This value will be useful when performing regular expression searches.
Return Value
Type: System.Nullable<SnapshotSpan>
Returns the search result found. If no match is found, returns nulla null reference (Nothing in Visual Basic).
Remarks
This method does not perform actual edits. Consumers must create an ITextEdit to perform actual text replacement. This method is safe to execute on any thread.
Note that expandedReplacePattern will always equal replacePattern if the search is not using regular expressions. In those scenarios, you can use the more lightweight Find.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.