---
title: "Pattern match condition"
canonical: "https://support.appfire.com/space/CSOTDC/3765141617/Pattern+match+condition"
format: markdown
---
> Macro (aura-html)

# Background

The [regular expression](https://appfire.atlassian.net/wiki/x/ugPfc) based pattern-match condition is a powerful way to automate workflows. It gives workflow designers, great control over the actions performed on transition issues.

## Pattern match condition

Pattern match condition is a highly flexible way that uses [Substitution variables](https://appfire.atlassian.net/l/cp/ZE0Ce7sx) to match the issue information with a [regular expression](https://appfire.atlassian.net/wiki/x/ugPfc) (regex). Although this method is a bit complex and less widely used for simple cases, it is a very powerful tool for covering many use cases. The simple cases can still be done with little knowledge of regular expressions. All the standard [Substitution variables](https://appfire.atlassian.net/l/cp/ZE0Ce7sx) can be used.

## Regex qualifiers

Qualifiers are used to make is easier to construct a regex pattern that matches the user scenario.

![image](media://43c52253-3011-482d-8f4d-0029294240fd)

## Exact

When looking for patterns, one can either **find** something that matches the pattern or you can do an **exact match** on the pattern. Doing **find** is usually easier and covers most use cases, but is not as precise as doing an **exact** match. The default is **Find**. Select the **Exact** checkbox if needed to be more precise. 

| Value | Pattern | Find | Exact Match |
| --- | --- | --- | --- |
| abc | abc | ✅ | ✅ |
| abc | ab | ✅ | ❌ |
| abc | ac | ❌ | ❌ |
| abc | b | ✅ | ❌ |
| abc | .*b.* | ✅ | ✅ |

## Literal

Regex has various characters that have special meaning. These characters need to be escaped (using **\**) if you want the character to **not** have special meaning. In some cases, you want to ignore all special character meaning and match on the literal string. Use the **Literal** checkbox to treat the pattern as a literal string.

| Value | Pattern | Normal | Literal |
| --- | --- | --- | --- |
| abc | .bc | ✅ | ❌ |
| .bc | .bc | ✅ | ✅ |
| abc | abc* | ✅ | ❌ |
| ab | abc* | ✅ | ❌ |
| ab | abc+ | ❌ | ❌ |

## Negative

Regex can be difficult when you want to condition on something **not** matching. The **Negative** checkbox makes it easy to **reverse** the condition so that the condition is true if the match is false and vice versa.

| Value | Pattern | Normal | Reverse |
| --- | --- | --- | --- |
| abc | abc | ✅ | ❌ |
| xyz | abc | ❌ | ✅ |
|  | \S+ | ❌ | ✅ |

## Case sensitivity

Regex patterns, by default, are **case sensitive**. Use the embedded flag **(?i)** to get case insensitive matching.

| Value | Pattern | Normal |
| --- | --- | --- |
| ABC | abc | ❌ |
| ABC | (?i)abc | ✅ |

## Or conditions

| Value | Pattern | Normal | Notes |
| --- | --- | --- | --- |
| a | a|b | ✅ |  |
| b | a|b | ✅ |  |
| abc | (abc)|(xyx) | ✅ | Use ( ) or (?: ) for grouping |


# More information

**Links to resources related to conditioning**

- [Condition the creation of issues](https://appfire.atlassian.net/l/cp/YzPt40qH)
- [Use regular expressions](https://appfire.atlassian.net/wiki/x/ugPfc)

> ✅ **What if I don't need conditions?**
> ✅ 
> ✅ Just leave blank (default).

> ✅ **Regex references**
> ✅ 
> ✅ Concise summary of regex pattern syntax and special characters - [Java pattern](http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html) 
> ✅ 
> ✅ Reference - [Regex expressions](http://www.regular-expressions.info/reference.html)

> ✅ **Watch out for regex reserved characters**
> ✅ 
> ✅ Unless you use **literal**, you need to be sure any regex reserved characters you use are intentional. Otherwise, you must escape them with **\**
> ✅ 
> ✅ Examples: *** +** **(** **) { } |**

> ✅ Test your regex interactively before you implement your workflow conditions using one of the regex testing websites like: [RegexPlanet](http://www.regexplanet.com/advanced/java/index.html).

> ✅ **Conditions must both be met**
> ✅ 
> ✅ If more than one condition is specified, both must be satisfied (the conditions are **anded**). Most **OR** conditions can be done through a single (more complex) regex pattern. See the tip below.

> ✅ **What if I have more than 2 conditions?**
> ✅ 
> ✅ Regex patterns can be constructed to handle many situations that involve multiple comparisons.
> ✅ 
> ✅ **Example**
> ✅ 
> ✅ **Value**: Priority: %original_priority%, Status: %original_status%
> ✅ 
> ✅ **Regex**: Priority: (Blocker|Critical|Major), Status: (Open|In Progress)
> ✅ 
> ✅ **RegexPlanet results**
> ✅ 
> ✅ ![image](media://1762692e-8dfc-490e-88ca-78a935b22392)