FindExtractedText

Finds patterns in the document or page.

Restriction: This action does not support regular expressions containing a line break nor tab expressions.

Syntax

bool FindExtractedText (string Target, string Scope, string Entity, string Source, string SearchField, string SearchRegex)

Parameters

Target
Smart parameter for the target object to save the value to. If used on a field use @F to update the current field.
Scope
Smart parameter first|Last|All
Populates the target using the match or matches by using the specified entity type, search field, and search expression. If First is specified, the first match is used. If Last is specified the last match is used. If All is specified a sub field will be created for all matches. All is supported only when the target is a DCO object and is not supported for variables.
Entity
Smart parameter name of the entity to match. For example Address.Address for a result from the ExtractText action, or Person for a result from the ExtractTextAlchemyLanguage action. The format of the entity name is Module.OutputView.
SearchField
Optional. Smart parameter name of the entity field to match. For example city. If specified, matching will be limited to the specified field. If the Entity parameter is set to Field, this field's value will be used to update the target.
SearchRegex
Optional. Smart parameter regular expression to search for. To search for a word use (SearchWord).

Returns

True when a match is found. Otherwise, False.

Level

Any

Details

Populates a field or variable with a value found using the ExtractText and ExtractTextAlchemyLanguage actions.

Important: The results from the ExtractText and ExtractTextAlchemyLanguage actions will be saved to the layout XML file (for example: tm000001_layout.xml), which can be opened in a text editor to see the available entities and the entitiy fields that can be copied into document hierarchy fields. You can search for an entity in the layout XML using its name such as Address.Address, or Person.
If the source is Entity: This can be used to create the line item detail structure in the run time hierarchy for capturing a list of items to be exported.
  • If the Target has sub fields defined and the sub field types match the entity field names they will be populated.
  • If the Target has sub fields and the sub fields have a variable named entityMap with a value that is the same as the entity field name in the layout.xml file the sub field of the target will be populated.
  • If the Target does not have a sub field mapped to an entity field name a variable will be created using the entity field name.
FindExtractedText requires a previously created layout file (for example: tm000001_layout.xml) where text is grouped into blocks. See DocumentAnalytics actions for information on the layout XML file.

ExtractText example 1

This example will populate a page field called City with the first address in California.

Recognize()
ExtractText(Address.Address)
FindExtractedText(@P\City,First,Address.Address,city,stateorprovince,(California)|(CA))

ExtractText example 2

This example will create a line item for each address found in the document.

The following document hierarchy is expected to be defined:
Field AddressDetail
     Field LineItem
          Field City
               Variable entityMap=city
          Field State
               Variable entityMap=stateorprovince
Recognize()
ExtractText(Address.Address)
FindExtractedText(@P\AddressDetail,All,Address.Address,,,)

ExtractText example 3

This example will populate variables city, stateorprovince, zip and address on the target field AddressDetail.

Recognize()
ExtractText(Address.Address)
FindExtractedText(@P\AddressDetail,First,Address.Address,,,)

ExtractTextAlchemyLanguage example 1

This example will populate a page field called Person with the first Person returned by AlchemyAPI.

Recognize()
ExtractTextAlchemyLanguage(entity)
FindExtractedText(@P\Person,First,enity,text,type,Person)