flow.match

Match against multiple regex patterns.

# Match a/b/c/d
- value: (@ flow.foo )
  match:
    (?P<a_group>a+):
      say: A (@ flow.groups.a_group )
    b.b:
      jump: b
    (cc)+:
      jump: c
  default:
    jump: d

Each condition in the match field must contain a valid action field,
meaning the field takes an action spec which maps to the ActionComponentSpec
Python class. This allows you to execute any component, but you will mostly
use one of the flow control components.

Also, Meya uses the Python regular expression syntax for all regex patterns.

Match groups

If your regex pattern defines any match groups, then these match groups
will be available in flow scope under (@ flow.groups ).

Element details

type: meya.flow.component.match
class: MatchComponent
path: /meya/flow/component/match.py
signature: match

Fields

fielddescription               requiredsignaturedefaulttype
specOverride the original spec for this element.nullSpec
contextSend context data with this component's event.{}
dict
sensitiveMark this component's event as sensitive. This will encrypt the event if the Sensitive Data integration has been enabled.falsebool
triggersActivate these dynamic triggers when the component runs. Check the component triggers guide for more info.[]list
valueSets the value that needs to be matched against the multiple regex patterns. If value is not defined, then the component will try use the value set in (@ flow.result ), if no value could be found then an error is raised.nulltyping.Any
ignorecaseIgnore the case of the value field.nullbool
matchContains a set of regex patterns and actions that will be evaluated against the value defined in the value field. The action is a component reference that is called when the value matches the regex pattern.dict
defaultThis the default action should the value not match any of the regex patterns.ActionComponentSpec

Usage reference

Basic

triggers:
  - keyword: meya.flow.component.match
steps:
  - match:
      STRING: COMPONENT
    default: COMPONENT

Full

triggers:
  - keyword: meya.flow.component.match
steps:
  - spec:
      type: STRING
      data:
        STRING: ANY
      timeout: 123
      trigger_when: ANY
    context:
      STRING: ANY
    sensitive: false
    triggers:
      - type: STRING
        data:
          STRING: ANY
        timeout: 123
        trigger_when: ANY
    value: ANY
    ignorecase: false
    match:
      STRING: COMPONENT
    default: COMPONENT