Check Regex Match

Check if a text matches a regular expression pattern.

Overview

This operation checks if a text conforms to a regular expression pattern. It serves as a conditional check, allowing you to perform additional operations depending on the truth of the statement.

Syntax

This operation has two different formats. You can use either is matched by or matches to refer to the regular expression check.

1. Option 1

the text is "{input}"
the regular expression is "{regex}"
if the text matches the regular expression then
	{action}

2. Option 2

the text is "{input}"
the regular expression is "{regex}"
if the text is matched by the regular expression then
	{action}

Data

The table below lists the names of the data elements in this operation and indicates which can be renamed in the syntax.

Data NameCan Be Renamed
the textYes
the regular expressionNo

Parameters

Parameters are placeholders for data. Refer to the table below for details on each parameter in this operation. In the syntax, replace parameters with your own values.

Parameter

Description

Examples

Required

input

An input text to be checked against the regular expression.

  • user123
  • Welcome to Kognitos.

Yes

regex

A regular expression that defines the criteria the text must match.

  • ^[a-zA-Z0-9]+$
  • ^\d3$

Yes

action

An operation that occurs if input conforms to the regular expression.

  • say "The username contains only letters and numbers."

Yes

Examples

1. Validate Username Format

the username is "user123"
the regular expression is "^[a-zA-Z0-9]+$"
if the username matches the regular expression then
  say "The username contains only letters and numbers."
The username contains only letters and numbers.