String processing methods

Jira Service Management provides string processing methods to parse incoming emails in email to alert rules, automation, etc.

Jira Service Management email rules allow processing these emails, extracting information from email data, assign to appropriate alert fields, and take the appropriate action (create, acknowledge, close, etc.) To extract data from incoming emails, Jira Service Management provides string processing methods. The following methods are currently supported:

toLowerCase(): converts all the characters within the text to lowercase and returns the resulting string

{{ message.toLowerCase() }}

toUpperCase(): converts all the characters within the text to upper case and returns the resulting string

{{ message.toUpperCase() }}

substring(int from), substring(int from, int to): returns the string between specified indices. "from" is included "to" is excluded.
{{ from_name.substring(5,20) }}

substringAfter(String from): returns the string after the specified parameter

{{ subject.substringAfter("Host") }}

substringBefore(String to): returns the string before the specified parameter
{{ from_address.substringBefore("@") }}

substringBetween(String from, String to): returns the string between from and to parameters
{{ subject.substringBetween("URL:","(") }}

extract(regular expression): returns part of the string that matches the parenthesized section of the regular expression.
{{ message.extract(/Host: (\S+)/) }}

Learn more about the extract method.

Regex match operations has 10 seconds timeout limit. If it takes more than 10 seconds, it returns "null"string.

toDate(): returns date time conversion of a timestamp. Uses default values of "yyyy-MM-dd HH:mm:ss ZZZ" for time date format; "GMT" for time zone.
{{ message.toDate() }}

toDate(String dateTimeFormat): returns date time conversion of a timestamp. Time format argument should follow the Java's Simple Date formatting pattern. Uses default value of "GMT" for time zone.
{{ message.toDate("yyyy-MM") }}

toDate(String dateTimeFormat, String timeZone): returns date time conversion of a timestamp. Time format argument should follow the Java's Simple Date formatting pattern.
{{ message.toDate("yyyy-MM", "GMT+2") }}

toReadableNumber(): Removes the + characters if exists and splits all the characters within the given string by single whitespaces. Applying this method to phone numbers within alert messages is the most common case to be able to listen each digit within phone numbers one by one.
{{ from.toReadableNumber() }}

removeAllWhitespace(): Removes any white space, new line, tab and carriage return characters from the specified parameter and returns the resulting string.
{{ message.removeAllWhitespace() }}

urlEncode(): Converts a string to the application/x-www-form-urlencoded MIME format, based on the UTF-8 character set. Learn more about special characters in URI attribute values.
{{ subject.urlEncode() }}