UiPath Documentation
document-understanding
2020.10
false
Guia do usuário do Document Understanding.
Importante :
A localização de um conteúdo recém-publicado pode levar de 1 a 2 semanas para ficar disponível.

Regex Based Extractor

O que é o RegEx Based Extractor

O Regex Based Extractor é a ferramenta perfeita para casos de uso simples, nos quais, para determinados campos, os dados são sempre encontrados em um formato e contexto rigorosos e previsíveis. Em outras palavras, se você tiver um campo para o qual possa definir uma Expressão Regular que seja consistentemente boa quando correspondida, o Regex Based Extractor é uma boa escolha.

A atividade vem com um assistente de configuração que o ajuda a definir as expressões regulares para os campos que você deseja direcionar para extração de dados dessa maneira.

A atividade suporta campos simples e extração de campos de tabela.

Recomenda-se procurar outros métodos de extração, caso haja uma alta variabilidade do contexto e formato dos valores esperados. Nesses casos, um Form Extractor ou um Machine Learning Extractor pode ser mais adequado.

Este extrator não possui recursos de aprendizado (treinamento) e requer configuração antecipada.

Requisitos especiais

Não há requisitos especiais para usar o Regex Based Extractor.

Como configurar

Configuração da atividade

O Regex Based Extractor tem duas configurações principais a serem consideradas:

  • o assistente Configurar expressões regulares - que permite definir expressões regulares para determinados campos. Este assistente também disponibiliza o assistente Regex Editor, que o auxilia na construção de suas expressões regulares.
  • a configuração UseVisualAlignment - que permite controlar se as expressões regulares configuradas para um extrator devem ser aplicadas à saída de texto do componente de digitalização ou a uma versão de texto na qual as linhas de texto são organizadas visualmente e as palavras são reorganizadas em linhas com base em seu alinhamento visual.

Assistente para configuração de Expressões Regulares

The Configure Regular Expressions Wizard can be used for defining regular expressions to be used to capture data for both simple as well as table fields.

  1. Add a RegEx Based Extractor activity to your workflow, within a Data Extraction Scope activity.

  2. Configure your regular expressions by clicking on the Configure Expressions button.

    • The Wizard window opens.

  3. Expanda uma entrada de tipo de documento para ver todos os campos definidos e para começar a configurar suas expressões regulares. Os tipos de documento e seus respectivos campos são lidos automaticamente a partir da Taxonomia do projeto. A opção de configuração de RegEx está disponível para todos os campos da taxonomia.

    • tipo de documento expandido mostrando um único campo regular:

    • Tipo de documento expandido e campo de tabela, exibindo opções de configuração para uma tabela:

      Para um campo simples, apenas uma única expressão regular pode ser definida usando o assistente RegEx que é aberto quando você clica na opção "Editar" ao lado desse campo.

      Para um campo de tabela, há várias configurações e opções disponíveis para definição:

    • The Table Value RegEx can be used for capturing an entire table area. If no value is added on the Table field line, the entire text content of the document is considered onward for table processing.

    • The Rows Value RegEx can be used for capturing an entire row from a given table capture. If no value is added on the Rows field line, the table area is split by end-of-line. Each captured value is considered from this point forward as a row on which the column extraction is to be applied.

    • The Column Value RegEx can be used for capturing the value of a particular column, from each captured row.

      Scenarios of using the Table, Rows and Column Regex:

    • If you leave the Table RegEx and the Rows RegEx fields empty, all lines in the text version of the document are used to apply the Column Level Regexes for cell value identification.

    • If you define a RegEx to capture the table area, but leave the Rows RegEx empty, all lines in the table capture are individually processed using each Column RegEx to capture the cell values.

    • If you leave the Table RegEx empty but define a Rows RegEx, then all text captured with the Rows RegEx is used and the Column RegExes are applied to capture cell values for each row.

    • If you fill in both Table and Rows RegEx, the activity applies the Table RegEx to identify the table string, then applies the Rows RegEx to identify each line, followed by the Column Level RegEx for capturing cell values.

  4. Add your Regular Expression in the Expression field.

    Observação:

    Forneça um RegEx ou crie um

    You have the option of either writing the whole RegEx in the Expression field or to build it by using the Edit button.

    Importante:

    Especifique seus grupos de captura!

    For any of the regular expressions you define, make sure you have at least one capture group! Only the captured parts of an expression are used for value reporting.

  5. Click on the drop-down list from the Regex Options column. You can set Regex Options from this multi-select option.

  6. Há várias opções que você pode escolher:

  • CultureInvariant - Specifies that the linguistic cultural differences are ignored.

  • ECMAScript - Enables ECMA Script compliant behavior for the expression. This value can be used only in conjunction with the IgnoreCase and Multiline options.

  • ExplicitCapture - Specifies that the only valid captures are the ones of groups that are explicitly named or numbered and are defined as (?<name> subexpression). Any unnamed parentheses are to be ignored.

  • IgnoreCase - Specifies that the search is not case sensitive.

  • IgnorePatternWhitespace - Eliminates the unescaped white space from the defined pattern and enables the comments marked with #. This option does not apply to character classes, numeric quantifiers, or tokens marking the beginning of an individual RegEx language element.

  • Singleline - Specifies that the search is initiated in a single line. The dot (.) matches all characters, including the exception \n.

  • Multiline - Specifies that the search is initiated in multiple lines. For this option, the special characters ^ and $ match the beginning and the ending of any line.

  • RightToLeft - Specifies that the search is performed from right to left.

    Observação:

    More information about the Regular Expression Options can be found here.

Assistente do Editor RegEx

  1. Click on the Edit button to edit the options of that field and the format of the regular expression.

  2. Add text in the Test Text field for testing the search criteria you choose against the text that you want to apply RegEx on.

  3. Selecione um dos tipos de fórmula RegEx na lista suspensa. Isso define a expressão regular para corresponder a uma das seguintes características:

    • Literal - Matches the exact characters specified by you. This option is case sensitive.

    • Digit - Matches a digit.

    • One of - Matches a single character present in the set.

    • Not one of - Matches a single character not present in the set.

    • Anything - Matches any character, except for \n.

    • Any word character - Matches any letters and numbers.

    • Whitespace - Matches one white space.

    • Starts with - Initiates the search where the line starts.

    • Ends with - Initiates the search where the line ends.

    • Advanced - Requires a custom expression.

    • Email - Matches an email address.

    • URL - Matches an URL.

    • US date - Matches the US date format.

    • US phone number - Matches the US phone number format.

      Observação:

      More information about the Regular Expressions in .NET can be found here.

  4. Use the Value field to write the value of the regular expression.

  5. Select a quantifier from the Quantifiers drop-down list.

Exactly - Matches the preceding element exactly how many times it is specified. By default, it is set to 1.

Any (0 or more) - Matches the preceding element for zero or more times, but as few times as possible.

At least one (1 or more) - Matches the preceding element for one or more times.

Zero or one - Matches the preceding element for zero or one time, but for as few times as possible.

Between x and y times - Matches the preceding element between x and y times, where x and y are integers, but as few times as possible.

  1. Use the Imagem dos documentos button for adding an extra RegEx field. Move fields up and down in the hierarchy by using the Imagem dos documentos and Imagem dos documentos buttons. Use the Imagem dos documentos button for deleting the field.

  2. Select the check box for the Capture option if you want to extract that specific field.

  3. The Full Expression field shows the entire expression, exactly how it was customized by you.

  4. Select one or more options from the Regex Options drop-down list.

  5. Click the Save button once all your configurations are done to exit the Edit mode and then click the Save once again for closing the wizard.

Esta página foi útil?

Conectar

Precisa de ajuda? Suporte

Quer aprender? Academia UiPath

Tem perguntas? Fórum do UiPath

Fique por dentro das novidades