IRegexSearchResult Interface
Defines the interface used for text searching, using regular expressions.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v23.1.Core.dll
NuGet Package: DevExpress.RichEdit.Core
Declaration
Remarks
The SubDocument.StartSearch method provides the IRegexSearchResult interface. You can then use the Match interface to get the match, continue searching or perform the replacement.
Example
The following code illustrates how to find and parse dates in US format using Regular Expression pattern matching:
document.AppendText("12\\14\\2014" + Environment.NewLine);
IRegexSearchResult result;
string pattern = @"(?<mm>\d{2}).(?<dd>\d{2}).(?<yyyy>\d{4})";
System.Text.RegularExpressions.Regex myRegEx =
new System.Text.RegularExpressions.Regex(pattern);
result = document.StartSearch(myRegEx);
if (result.FindNext())
{
string dayFound = result.Match.Groups[2].Value;
string monthFound = result.Match.Groups[1].Value;
string yearFound = 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));
}
See Also