Adding Regex Pattern Mappings Guidelines
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 ‘summary’ 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.
Â
Â
Validating The Regex :
After inputting the Regex pattern and input data in the text area field, click the 'Validate regex' link to see the matches result in the result column.
In this example, the given regex pattern is returning a value ‘This is my new demo issue.’ based on the input data. Once the same pattern is used in a Rule as shown below, the rule can set the field ‘summary’ as ‘This is my new demo issue.’.
Â
Â
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 "Clear the field" 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 |
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