# substring() in Jira Automation: syntax and examples

URL: https://goingstellar.ro/reference/smart-values/substring/

substring(start) returns everything from a zero-based position to the end, and substring(start, end) returns the characters from start up to, but not including, end. Use it when you know where the part you need sits.

## Syntax

```
{{issue.summary.substring(7)}}
{{issue.summary.substring(1,3)}}
```

## Arguments

- `start` (required: yes): Zero-based position of the first character to keep
- `end` (required: no): Position where the cut stops; the character at this position is not included

## Works on

- Fields: text smart values
- Returns: text

## Examples

```
{{issue.summary.substring(6)}}
```

Drop the first word of a title. With a summary of Hello World! position 6 is the W.

Result:

```
World!
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.substring(0,5)}}
```

Keep the first five characters. The end position is not part of the result.

Result:

```
Hello
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.description.substring(0,13)}}
```

Take the opening words of a description for a short notification.

Result:

```
Checkout page
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.substring(-6)}}
```

A negative start counts from the end of the text, so this returns the last six characters.

Result:

```
World!
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.substring(6,-1)}}
```

A negative end counts from the end too, which drops the final character.

Result:

```
World
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.substring(0,100)}}
```

An end past the length of the text is accepted and the whole text comes back.

Result:

```
Hello World!
```

Run on Jira Cloud on 29 Nov 2026.

## Pitfalls

- Positions start at 0, and the end position is excluded. `substring(1,3)` returns two characters (el), not three.
- Out-of-range input does not raise an error. A start beyond the end of the text, or an end before the start, produces an empty text (checked on Jira Cloud, November 2026), so a typo in a number shows up as an empty field.
- When the position depends on the content, such as everything after a dash, `substringAfter()` is more reliable than counting characters.

## Related

- [left() and right()](https://goingstellar.ro/reference/smart-values/left-right/)
- [substringAfter(), substringBefore(), substringBetween()](https://goingstellar.ro/reference/smart-values/substringafter-substringbefore/)
- [charAt()](https://goingstellar.ro/reference/smart-values/charat/)
- [indexOf() and lastIndexOf()](https://goingstellar.ro/reference/smart-values/indexof/)
- [length()](https://goingstellar.ro/reference/smart-values/length/)
- [abbreviate()](https://goingstellar.ro/reference/smart-values/abbreviate/)

## Sources

- [Jira smart values: text fields (Atlassian Support)](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/)

