Share via


IEditorOperations.ReplaceAllMatches Method

Replaces all matching occurrences of the given string.

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

Syntax

'Declaration
Function ReplaceAllMatches ( _
    searchText As String, _
    replaceText As String, _
    matchCase As Boolean, _
    matchWholeWord As Boolean, _
    useRegularExpressions As Boolean _
) As Integer
int ReplaceAllMatches(
    string searchText,
    string replaceText,
    bool matchCase,
    bool matchWholeWord,
    bool useRegularExpressions
)
int ReplaceAllMatches(
    String^ searchText, 
    String^ replaceText, 
    bool matchCase, 
    bool matchWholeWord, 
    bool useRegularExpressions
)
abstract ReplaceAllMatches : 
        searchText:string * 
        replaceText:string * 
        matchCase:bool * 
        matchWholeWord:bool * 
        useRegularExpressions:bool -> int
function ReplaceAllMatches(
    searchText : String, 
    replaceText : String, 
    matchCase : boolean, 
    matchWholeWord : boolean, 
    useRegularExpressions : boolean
) : int

Parameters

  • matchCase
    Type: System.Boolean

    true if the search should match case, otherwise false.

  • matchWholeWord
    Type: System.Boolean

    true if the search should match whole words, otherwise false.

  • useRegularExpressions
    Type: System.Boolean

    true if the search should use regular expressions, otherwise false.

Return Value

Type: System.Int32
The number of matches found.

Exceptions

Exception Condition
ArgumentNullException

searchText is nulla null reference (Nothing in Visual Basic).

ArgumentException

useRegularExpressions is true and searchText is an invalid regular expression.

Remarks

If any of the matches found is read-only, none of the matches will be replaced.

.NET Framework Security

See Also

Reference

IEditorOperations Interface

Microsoft.VisualStudio.Text.Operations Namespace