Page tree

Skip to end of metadata
Go to start of metadata

On this page

Overview

A number of add-ons provide advanced features that require the use of regular expressions for pattern matching. Generally, just a simple understanding of regular expressions and a few examples are enough to get by for most use cases. This will just give a few simple examples to get started. Use the references for more advanced information. We recommend using one of the regex test sites (we do all the time!!!) - RegexPlanet or Regex101.

Regex for workflow conditions

For JIRA workflow functions using regex expressions to condition whether the post function should continue processing, a blank pattern means that condition processing is not done and processing should continue.

Key tips

  1. Dot or period (.) is a special regex character. If you really want to match on it, you need to escape it with a backslash: \.
  2. Don't be confused with generic pattern matching used for file systems for instance. On a file system, *.png means all files ending with .png. That is an illegal regex expression. For regex you need: .*\.png. Or to simplify: .*png which will find all files ending in png (not necessarily ending in an extension of png).
  3. Regex is case sensitive by default. In most cases, use the case insensitive flag: (?i). See one of the examples below.
  4. Dotall mode when you need to match across line breaks. 

In dotall mode, the expression . matches any character, including a line terminator. By default this expression does not match line terminators. Dotall mode can also be enabled via the embedded flag expression (?s). (The s is a mnemonic for "single-line" mode, which is what this is called in Perl.)

Simple Examples




Advanced Examples

Value
Regex
Matches
Demonstrates
example.txt 
^((?!\.png).)*$
(tick)Match string not containing a word. In this example, files that do not have a .png extension
example.png 
^((?!\.png).)*$
(error)Match string not containing a word. In this example, files that do not have a .png extension
collateral wholesale retail.*(?=.*\bretail\b.*)(?=.*\bcollateral\b.*).*(tick)Match exact words anywhere in string. In this case a blank separated list of labels and we require both collateral and retail to be included before we want the match to be successful
wholesale retail.*(?=.*\bretail\b.*)(?=.*\bcollateral\b.*).*(error)Both are required for a match
merger acquisition.*\b(?:merger|acquisition)\b.*(tick)Match string containing either word

References