• Overview
  • Functions
    • Overview
    • action
    • connect
    • create_issue
    • create_vertex
    • dateprint
    • delete_vertex
    • disconnect
    • eject_issue
    • execute
    • find_timeseries
    • html_extract
    • if
    • javascript
    • log
    • query
    • read_timeseries
    • read_vertex
    • regex
    • sleep
    • split
    • stop_issue
    • suspend
    • suspend_until
    • update_vertex
    • write_timeseries
  • Definitions
  • Automation Issue Lifecycle
  • Automation Issue Lifecycle - Corner Cases
  • Hints for KI-Writers
  • HIRO 6 - Transition Guide for Users having used HIRO 5 before
  • Transition from KI Syntax 5
Table of Contents

Definition

This can by used to extract part of a string using a regular expression. Only the first sub-match (first pair of matching parenthesis) will be extracted.

The internal Elixir regex library is used, which is based on PCRE (Perl Compatible Regular Expressions). Please refer to the elixir documentation for further details.

Usage

result: LOCAL::RESULT = regex("<text to be matched>", expression: "<regex expression>")
Table 1. Arguments
Position Keyword Required Description

1

string

X

String onto which the regex is applied

2

expression

X

Regular Expression, needs exactly one SubMatch-Pattern. e.g. "Value: (0-9+) Seconds"

Table 2. Return Values
Tag Description

result

Extracted substring

Example

result: LOCAL::RESULT = regex("Here is a hidden value 47.11 inside", expression: ".*value ([0-9.]+) .*")

Description

In this example we match a "string" that contains: "Here is a hidden value 47.11 inside". We want to extract the number value from this so our regex matches only numbers with a decimal point.

The resulting match of the regex is "47.11". This value is then stored in the variable RESULT in the LOCAL scope.