SubDocument.FindAll(Regex, DocumentRange) Method
Finds all occurrences of a character pattern specified by the regular expression.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v19.1.Core.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
regex | Regex | A Regex object representing a regular expression to search. |
range | DocumentRange | A DocumentRange instance representing a document range to search. |
Returns
Type | Description |
---|---|
DocumentRange[] | An array of DocumentRange objects representing ranges in the document matching the specified pattern. |
Remarks
The default maximum length of a string that can be obtained in a regular expression search is 128 characters. Use the DocumentSearchOptions.RegExResultMaxGuaranteedLength property to change the maximum string length.
Example
This code snippet finds all numbers enclosed in square brackets within the selected text.
using DevExpress.XtraRichEdit.API.Native;
using System.Text.RegularExpressions;
// ...
Regex expr = new Regex("\\[[0-9]+\\]");
DocumentRange[] found =
richEditControl.Document.FindAll(expr, richEditControl.Document.Selection);
See Also