.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

SubDocument.StartSearch(Regex, DocumentRange) Method

Provides a search interface for a search in the specified range using a regular expression pattern.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v20.1.Core.dll


IRegexSearchResult StartSearch(
    Regex regex,
    DocumentRange range
Function StartSearch(
    regex As Regex,
    range As DocumentRange
) As IRegexSearchResult


Name Type Description
regex Regex

A Regex object representing a search pattern.

range DocumentRange

A DocumentRange object representing a range to search.


Type Description

An IRegexSearchResult interface used to perform a search.


The following code snippet illustrates the use of the StartSearch method, to perform searching for the date in US format. Note the use of named captures in the Regular Expression pattern.

document.AppendText("12\14\2014" & Environment.NewLine)
Dim result As IRegexSearchResult
Dim pattern As String = "(?<mm>\d{2}).(?<dd>\d{2}).(?<yyyy>\d{4})"
Dim myRegEx As New System.Text.RegularExpressions.Regex(pattern)

result = document.StartSearch(myRegEx)
If result.FindNext() Then
    Dim dayFound As String = result.Match.Groups(2).Value
    Dim monthFound As String = result.Match.Groups(1).Value
    Dim yearFound As String = result.Match.Groups(3).Value
    document.AppendText(String.Format("Found a date that is the {0} day of the {1} month of the {2} year.", dayFound, monthFound, yearFound))
End If
See Also