TemplateRegexPosition Class
Provides a template field position which uses the regular expression.
Inheritance Hierarchy

Namespace: GroupDocs.Parser.Templates
Assembly: GroupDocs.Parser (in GroupDocs.Parser.dll) Version: 20.8.0
Syntax
public sealed class TemplateRegexPosition : TemplatePosition

The TemplateRegexPosition type exposes the following members.

Constructors
  NameDescription
Public methodTemplateRegexPosition(String)
Initializes a new instance of the TemplateRegexPosition class.
Public methodTemplateRegexPosition(String, Boolean)
Initializes a new instance of the TemplateRegexPosition class.
Properties
  NameDescription
Public propertyExpression
Gets the regular expression.
Public propertyMatchCase
Gets the value that indicates whether a text case isn't ignored.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples

The following example shows the situation if the document contains "Invoice Number INV-12345" then template field can be defined in the following way:

C#
// Create a regex template field with "InvoiceNumber" name
TemplateField templateField = new TemplateField(
    new TemplateRegexPosition("Invoice Number\\s+[A-Z0-9\\-]+"),
    "InvoiceNumber");

In this case as a value the entire string is extracted. To extract only a part of the string the regular expression group "value" is used:

C#
// Create a regex template field with "InvoiceNumber" name with "value" group
TemplateField templateField = new TemplateField(
    new TemplateRegexPosition("Invoice Number\\s+(?<value>[A-Z0-9\\-]+)"),
    "InvoiceNumber");

In this case as a value "INV-3337" string is extracted.

See Also