ITextSearchService2.FindForReplace Method (SnapshotPoint, 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
'Dichiarazione
Function FindForReplace ( _
startingPosition As SnapshotPoint, _
searchPattern As String, _
replacePattern As String, _
options As FindOptions, _
<OutAttribute> ByRef expandedReplacePattern As String _
) As Nullable(Of SnapshotSpan)
Nullable<SnapshotSpan> FindForReplace(
SnapshotPoint startingPosition,
string searchPattern,
string replacePattern,
FindOptions options,
out string expandedReplacePattern
)
Nullable<SnapshotSpan> FindForReplace(
SnapshotPoint startingPosition,
String^ searchPattern,
String^ replacePattern,
FindOptions options,
[OutAttribute] String^% expandedReplacePattern
)
abstract FindForReplace :
startingPosition:SnapshotPoint *
searchPattern:string *
replacePattern:string *
options:FindOptions *
expandedReplacePattern:string byref -> Nullable<SnapshotSpan>
function FindForReplace(
startingPosition : SnapshotPoint,
searchPattern : String,
replacePattern : String,
options : FindOptions,
expandedReplacePattern : String
) : Nullable<SnapshotSpan>
Parameters
- startingPosition
Type: Microsoft.VisualStudio.Text.SnapshotPoint
The position from which the search is started. The search will be performed on the ITextSnapshot to which this parameter belongs.
- 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.