TemplateRegexPosition Class |
Namespace: GroupDocs.Parser.Templates
The TemplateRegexPosition type exposes the following members.
Name | Description | |
---|---|---|
![]() | TemplateRegexPosition(String) |
Initializes a new instance of the TemplateRegexPosition class.
|
![]() | TemplateRegexPosition(String, Boolean) |
Initializes a new instance of the TemplateRegexPosition class.
|
Name | Description | |
---|---|---|
![]() | Expression |
Gets the regular expression.
|
![]() | MatchCase |
Gets the value that indicates whether a text case isn't ignored.
|
Name | Description | |
---|---|---|
![]() | Equals | (Inherited from Object.) |
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetType | (Inherited from Object.) |
![]() | ToString | (Inherited from Object.) |
The following example shows the situation if the document contains "Invoice Number INV-12345" then template field can be defined in the following way:
// 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:
// 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.