Articles on: Web App
This article is also available in:

How to Write / Formulation Regex

Articles on: Workflows & Activities

Regex is a regular expression that defines or restricts what a user inputs/fill on the input questions (Input text, Integer, decimal, etc).  We have a provision to use it both in the list and in the workflows, see below on how to formulate one. 

Characters definition;


[] - A set of characters

\ - Signals a special sequence (can also be used to escape special characters)

. - Any character (except newline character)

^ - Starts with

$ - Ends with

{} - Exactly the specified number of occurrences

| - Either or - Used to easily combine regex with two or more functions

() - Capture and group


Sets descriptions;


[0123] - Returns a match where any of the specified digits (0, 1, 2, or 3) are present

[0-9] - Returns a match for any digit between 0 and 9

[0-5][0-9] - Returns a match for any two-digit numbers from 00 and 59


Examples

^([1-9]|1[012])$


^ -  Anchors the regex at the start of the string

[1-9] - Matches 1 to 9

| - Basically used when you want to combine two or more regex - alternation matches the previous match or the following match.

1[012] - Matches 10, 11, or 12

$ - Anchors the regex at the end of the string.


^2[0-9]{10}$ - Allows 10 Digits starting with a 2.

^[0]{1}[1-9]{1}[0-9]{8}$ - Values need to have alteast 10 digits starting with a 0

^237[0-9]{9}$ - Values need to have at least 12 digits starting with 237


The best site to use in formulating Regex and testing them is Regex101, Please do test these Regex first before implementing them on the workflows/list.

Updated on: 27/02/2023

Updated on: 25/05/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!