Skip to main content

Regular expressions in Actioner

Learn how to use regular expressions in Actioner.


Regular expressions, also known as regex, are patterns used to match and manipulate text. In Actioner, you can use regex to validate data entered in your inputs and table record.

A regex pattern consists of a combination of characters and symbols that form a search pattern. This search pattern can be used for text search in Actioner.

To search for data in a text, you can construct a pattern to describe what you are searching for. The regular expression pattern can be a single character, or a more complicated one.

Regular expressions in Actioner

Actioner provides using JavaScript regular expressions to strengthen filtering and extracting information to define what value your input and/or table fields can take. You can filter the desired information in a more powerful way by using regular expressions on many cases.

Quick regular expression reference

Character classes

Character classes are used to match a specific set of characters. They are enclosed in square brackets.

  • g: global match
  • i: case-insensitive match
  • m: multi-line match
PatternEntered valueResult
[abc]hello worldfalse

You can also use ranges to match a range of characters. For example, [a-z] matches all lowercase alphabets, while [0-9] matches all digits.

Metacharacters

Metacharacters are special characters that have a special meaning in regex patterns. Some of the commonly used metacharacters are:

  • . matches any single character except for line terminators
  • * matches zero or more occurrences of the preceding character
  • + matches one or more occurrences of the preceding character
  • ? matches zero or one occurrences of the preceding character
  • ^ matches the start of a string
  • $ matches the end of a string
PatternEntered valueResult
^h.*d$hello worldtrue

You can also use metacharacters to match specific character types. For example, \d matches any digit, while \w matches any word character (alphanumeric characters and underscores).

Grouping

Grouping is used to create a subexpression within a regex pattern. It is enclosed in parentheses.

PatternEntered valueResult
(\w+)\s(\w+)hello worldtrue

You can also use grouping to capture specific parts of the matched string using capturing groups. Captured groups are numbered from left to right, starting from 1.

PatternEntered valueResult
(\d{3})-(\d{3})-(\d{4})My phone number is 123-456-7890123 456 7890

Alternation

Alternation is used to match any one of a set of alternatives. It is represented using the | symbol.

PatternEntered valueResult
`catdog`I love my cat

Lookahead

Lookahead is used to match a pattern only if it is followed by another pattern. It is represented using the (?=) syntax.

PatternEntered valueResult
\d(?= dollars)I have 100 dollarstrue

You can also use negative lookahead to match a pattern only if it is not followed by another pattern. Negative lookahead is represented using the (?! ) syntax.

PatternEntered valueResult
\d(?! dollars)I have 100 poundstrue

Commonly used regular expressions

  1. Match strings only contains numbers:
^[0-9]*$
  1. Match a URL: It will match the elements of a URL, including the protocol, subdomain, domain, path, filename, query parameters, and anchor.
^((http[s]?|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$
  1. Match an email address
^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$
  1. Match an IPv4 address
^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$