Word Matching

Word matching is a simple pattern-matching algorithm for use with Pattern Matching. See Patterns.

You cannot use variable values as input to a word pattern. If you need to use variables as part of a pattern, use the Regular Expression option.

When you select the plus sign to add a branch in the Pattern Matching step, the Word Matching branch appears.

  • A Word Matching pattern must match the entire input text.

  • The pattern can consist of text and variables that behave like wildcards.

  • A variable is denoted by embedding it in curly braces "{" and "}".

Example using $current variable:

The $current variable contains "This text is a word matching." The variable can be matched with a word pattern such as "This text is a {varName}," where the variable varName is assigned the Text value "word matching."

  • If {varName} is already declared as a variable, it is assigned the value "word matching" and is available in the scope of the variable.

  • If {varName} is not declared, it is created in the local scope of the pattern matching step and is not available outside the step.

  • All variables in the pattern that are not declared become type Text.

  • A previously defined variable can be any simple type, but an integer only matches an integer in the $current text.

    The integer variable intVar never matches anything in the $current text "This text is a word matching. "

    By contrast, if $current is "The cost is $42", it is matched by "The cost is ${intVar}" because the text "42" can be parsed to an integer.

Example using record type:

Assign the pattern to a field on a record type, if the field is a type where the text can be parsed into. In this example, we use the following parameters:

  • Type is a Person

  • Integer field age

  • Text field name

  • Robot contains a variable person of type Person

We can match the $current string "My name is John, I am 42 years old" with "My name is {person.name}, I am {person.age} years old."

This pattern assigns person.name to "John" and person.age to "42."