Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Mode Selection Options: Regex and Basic

Introduction:

Mode provides users with the flexibility to input data freely in Basic Mode or utilize regular expressions in Regex Mode. This empowers users to define patterns according to their preferences. The following guide outlines the process of mode selection, the Pattern Mapping dialog box, and validation procedures in both Basic and Regex Modes.

To initiate the Pattern Mapping dialog box, click on the "Add Rule" button to create a new rule, or, for an existing rule, choose the "Edit" button to make modifications, and for duplication, select the "Clone" button.

...

Upon selecting any of these options, the Pattern Mapping dialog box will appear as a pop-up window, as illustrated below.

...

The highlighted yellow area represents the Mode checkbox, with unchecked indicating Basic Mode and checked indicating Regex Mode. Default mode is Basic, checking the box switches to Regex. Multiple mapping rows can be added.

...

In Basic Mode, users can freely input data within curly braces "{value}" into the Pattern Field.

...

In Regex Mode, users can utilize regular expressions in the Pattern Field.

Pattern Field Validation:

...

If the 'Pattern' field is empty or not in the expected format when adding a pattern mapping, a popup message appears at the top, highlighting the respective field for user attention and correction.

...

After carefully selecting all the fields and ensuring that the specified condition in the Pattern field is met, proceed to click on "Add Pattern Mapping" to observe the newly created rule on the 'Configure Comment Handler' page.Use the check box highlighted below in the Create/ Edit or Clone dialogue to enable Regex mode for a particular rule item.

...

Next, provide a regex pattern in the ‘Pattern’ input. PFB is an example.

...

When in action, the input rich text field would be checked against the regex pattern for a match, if a match is found the same would be updated to the ‘Priority’ field in Jira.

Regex Helper

We recommend to Visit the 'Manage Apps’ → ‘Regex Helper' module in your Jira to test Regex patterns against input texts before using them in Rules.

...

The Regex Helper tool is designed to assist users in performing regular expression matches on input data. Users can input a valid regular expression and a set of data, and the tool will automatically perform the match.

...

Valid Regular Expression:

Crafting a valid regular expression requires precision in considering the pattern's structure and matching criteria. Successful matches, shown in blue, exemplify the data to be inserted into the custom field on the issue page, while red highlights indicate mismatches.

...

In this example, the given regex pattern is returning a value ‘High’ based on the input data. Once the same pattern is used in a Rule as shown below, the rule can set the field ‘Priority’ as ‘High’.

...

Invalid Regular Expression or Input Data:

When the regular expression is invalid or a regex match is NOT found in in the Input Data, a corresponding error message is shown in Red color. Tweak the regex/ input data to get a success output before using it in a actual rule.

...


Clearing Input Fields:

To clear the input fields, entered values in both the "REGULAR EXPRESSION" and "INPUT DATA" fields, and then click the "Cancel" link. This action will swiftly reset both fields, providing a convenient way to start fresh.

Sample regex patterns for reference:

Guide on regex patterns! Below, you'll find a collection of sample regular expressions (regex) to help you validate and extract phone numbers from text etc….

Input Data

priority=High
name=ABC
profile=ABC,
more details here,
Thank you.
assign=admin@admin.com

Priority Extraction:
Regex: priority\s*=\s*(\S+)

Extracted Value: High

Name Extraction:

Regex: name\s*=\s*([a-zA-Z]+)

Extracted Value: ABC

Profile Extraction (up to 3 lines):
Regex: profile=(.(?:\n(?![a-z]+=).)*)
Extracted Value: ABC,
more details here,
Thank you.

Email Address Extraction:
Regex: assign\s*=\s*([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})

Extracted Value: admin@admin.com

Phone Number Extraction:
Regex: phone\s*=\s*(\+?[0-9\s-]+)

Extracted Value: +1234567890