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
'宣言
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.
- searchPattern
Type: Microsoft.VisualStudio.Text.SnapshotSpan
[in] The text pattern to search for.
- replacePattern
Type: System.String
[in] The replace pattern to use for the operation.
- options
Type: Microsoft.VisualStudio.Text.SnapshotSpan
[in] Options to use for the search.
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
- 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.