Get started with Jira Service Management for admins
Your first stop for learning how to get started with Jira Service Management.
This article highlights a new alerting feature that's natively available in Jira Service Management which is gradually rolling out to some Jira Service Management Cloud customers. It may not yet be visible or available on your site.
Jira Service Management provides Java-like regular expressions to strengthen filtering and extracting information to define dynamic properties that you can use in integrations, alert policies, and callbacks. You can extract the desired information by using regular expressions in many cases - for example, defining a filtering rule with the Matches operator and extracting data to set for an alert field with the Extract string processing method.
The conditions with Matches operator are met if whole string value matches the pattern of the given regular expression. If the type of the input value is List, then the condition is matched if at least one of the list items matches the given regular expression. With this operator, you can define complex filtering in a single condition rule and reduce your dependency on already-defined condition operators. Read more about condition operators.
The following are some examples of common use cases in which using the Matches condition operator comes in handy.
To create an alert via your email integration, if the Subject contains "Daily Report" and the Description contains Critical, Error, or Down, you can use the following regex within the Matches rule: .*(Critical|Error|Down).*
To notify again of an alert if its description starts with one of the server names server1, server2, ..., server100, you can use the following regular expression within a single Matches rule instead of 20 Starts with rules: ^(server(100|[1-9]\d?)).*
To run a Webhook callback if the alert message contains a valid e-mail address, you can use the following regexp: .*(\s+.*)?([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})(\s+.*)?
You can use the extract string processing method to extract desired matching group according to a given regular expression to set into an alert field. Read more about string processing methods.
Working with the extract method may require an understanding of capturing groups to get desired results. It has two definitions:
field_name.extract(reg_exp):Gives part of the string that matches the first parenthesized section (group) of the given regular expression. If the string does not match the given regular expression, it returns empty string. If the given regular expression matches the string but does not contain any parenthesized sections, it returns the whole string.
field_name.extract(reg_exp, index): Gives the string that matches the indexth parenthesized section (group) of the given regular expression. If the string does not match the given regular expression, it returns an an empty string. If the given regular expression matches the string but does not contain at leathe st index number of parenthesized sections, it returns the whole string.
Read more about capturing groups.
The following are some examples using both method definitions:
message: Host: First Second
message.extract(/Host: (\S+)/)
= First
message.extract(/Host: (\S+) (\S+)/)
= First
message.extract(/Host:(\S+)/)
= Empty value
message.extract(/Host: (\S+)/, 0)
= Host: First Second
message.extract(/Host: (\S+)/, 1)
= First
message.extract(/Host: (\S+)/, 2)
= Host: First
message.extract(/Host: (\S+) (\S+)/, 2)
= Second
message.extract(/(\S)+/)
= Host:
message.extract(/\S+/)
= Host:
description: some value server3
description.extract(/(server(100|[1-9]\d?))/)
= server3
description.extract(/(server(100|[1-9]\d?))/, 1)
= server3
description.extract(/(server(100|[1-9]\d?))/, 2)
= 3
description.extract(/(server(100|[1-9]\d?))/, 3)
= server3
description.extract(/server(100|[1-9]\d?)/, 0)
= server3
description.extract(/server(100|[1-9]\d?)/, 1)
= 3
description.extract(/server(100|[1-9]\d?)/, 2)
= server3
description.extract(/(server(100|[1-9]\d?))/, 2)
= 3
To set the desired alert field using the extract method, write the text into the alert properties in one of the following patterns:
{{ field_name.extract(/reg_exp/) }}
{{ field_name.extract(/reg_exp/, group_number) }}
Was this helpful?