Jira Automation smart value
substringAfter() and substringBefore() in Jira Automation
These functions cut a text around a separator you name: substringBefore() and substringAfter() use the first match, the Last variants use the last match, and substringBetween() returns what sits between two markers. They are the tool for pulling an id or a keyword out of a pasted title.
Syntax
{{issue.summary.substringAfter("W")}}
{{issue.summary.substringBefore("W")}}
{{issue.summary.substringAfterLast("o")}}
{{issue.summary.substringBeforeLast("o")}}
{{issue.summary.substringBetween("e","d")}}
Arguments
| Argument | What it is | Required |
|---|---|---|
separator | The text to look for; the separator itself is not part of the result | yes |
open, close | For substringBetween(): the two markers around the part you want | yes |
Works on
- Fields: text smart values
- Returns: text, empty when the separator is not found (except substringBefore, see pitfalls)
Examples
{{issue.key.substringAfter("-")}}Get the number part of an issue key. For the key WEB-44 the result is 44.
Result:
44Run on Jira Cloud on .
{{issue.description.substringBefore(".")}}Use the first sentence of a description as a headline.
Result:
Checkout page redesignRun on Jira Cloud on .
{{issue.description.substringAfter(". ")}}Keep everything after the first sentence, for a comment that quotes the details.
Result:
Customer reported the total is wrong.Run on Jira Cloud on .
{{issue.description.substringBetween("the "," is")}}Pull out the word between two markers. The result is the value the customer says is wrong.
Result:
totalRun on Jira Cloud on .
{{issue.summary.substringAfterLast(" ")}}Take the last word of a title with the Last variant.
Result:
World!Run on Jira Cloud on .
{{issue.key.substringAfter("-").leftPad(5, "0")}}Chain: cut the number from the key and pad it to a fixed width for a reference code.
Result:
00043Run on Jira Cloud on .
Where the documentation differs
{{issue.summary.substringBefore("W")}}Run on Jira Cloud, : the documentation says
Hello, the actual result isHello.
Pitfalls
- The documentation shows
substringBefore("W")returning Hello. The result is Hello followed by a space, because the separator is W and the space before it stays in the text. Add trim() when you compare the result (checked on Jira Cloud, November 2026). - When the separator is missing, substringAfter() returns an empty text but
substringBefore()returns the whole text unchanged. Test with isEmpty() or compare the lengths before relying on it. - substringBetween() with a single marker, or with markers that do not appear, returns an empty text rather than an error.