Table of Contents

Class RegexSearchOptions

Namespace
LMKit.Document.Search
Assembly
LM-Kit.NET.dll

Options for regular expression search.

public sealed class RegexSearchOptions
Inheritance
RegexSearchOptions
Inherited Members

Examples

Example: Find phone numbers with regex search.

using System.Text.RegularExpressions;
using LMKit.Document.Search;

var regexOptions = new RegexSearchOptions { RegexOptions = RegexOptions.IgnoreCase | RegexOptions.Compiled, MaxResults = 100, ContextChars = 60 };

var engine = new LayoutSearchEngine(); IReadOnlyList<TextRegion> matches = engine.FindRegex( page, @"\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}", regexOptions);

Console.WriteLine($"Found {matches.Count} phone numbers."); foreach (TextRegion region in matches) { Console.WriteLine($" Page {region.PageIndex + 1}: {region.Snippet}"); }

Properties

ContextChars

Number of characters of context to include before and after the match in the snippet.

MaxResults

Maximum number of matches to return.

RegexOptions

Regex options; default enables case-insensitive and compiled execution.

Share