Partager via


ITextSearchService2.FindAllForReplace Method

Searches for all occurrences of the search pattern and calculates all the corresponding replacement results for every match according to the specified replacement pattern.

Namespace:  Microsoft.VisualStudio.Text.Operations
Assembly:  Microsoft.VisualStudio.Text.Logic (in Microsoft.VisualStudio.Text.Logic.dll)

Syntax

'Déclaration
Function FindAllForReplace ( _
    searchRange As Boolean, _
    searchPattern As SnapshotSpan, _
    replacePattern As String, _
    options As SnapshotSpan _
) As IEnumerable(Of Tuple)
IEnumerable<Tuple> FindAllForReplace(
    bool searchRange,
    SnapshotSpan searchPattern,
    string replacePattern,
    SnapshotSpan options
)
IEnumerable<Tuple^>^ FindAllForReplace(
    bool searchRange, 
    SnapshotSpan searchPattern, 
    String^ replacePattern, 
    SnapshotSpan options
)
abstract FindAllForReplace : 
        searchRange:bool * 
        searchPattern:SnapshotSpan * 
        replacePattern:string * 
        options:SnapshotSpan -> IEnumerable<Tuple> 
function FindAllForReplace(
    searchRange : boolean, 
    searchPattern : SnapshotSpan, 
    replacePattern : String, 
    options : SnapshotSpan
) : IEnumerable<Tuple>

Parameters

  • searchRange
    Type: System.Boolean
    [in] The range of text to search in.
  • replacePattern
    Type: System.String
    [in] The replace pattern to use for the operation.

Return Value

Type: System.Collections.Generic.IEnumerable<Tuple<T1, T2>>
Returns an enumeration of all matches found and their corresponding replacement values. Returned value contains a collection of tuples; each tuple contains a SnapshotSpan referencing the location of the match and a string containing the calculated replacement text for the match. Returns empty enumeration if no matches are found.

Remarks

If the search is not using regular expressions, then the calculated replacement text will always equal the specified replacePattern. In this scenario, you can use the FindAll method to obtain only the search results.

.NET Framework Security

See Also

Reference

ITextSearchService2 Interface

Microsoft.VisualStudio.Text.Operations Namespace