# replace(), replaceAll(), remove(): syntax and examples

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

replace() swaps every occurrence of a literal piece of text, replaceAll() does the same with a regular expression and can reuse matched groups, and remove() deletes a piece of text. They clean pasted titles, build slugs and reshape values before another action uses them.

## Syntax

```
{{issue.summary.replace("target", "replacement")}}
{{issue.summary.replaceAll("regex", "replacement")}}
{{issue.summary.remove("text")}}
```

## Arguments

- `target / regex / text` (required: yes): What to find. replace() and remove() treat it as plain text, replaceAll() as a regular expression.
- `replacement` (required: yes (not for remove)): The text to put in its place. In replaceAll() a group is written as a dollar sign and its number.

## Works on

- Fields: any text value
- Returns: the changed text; unchanged when nothing matches

## Examples

```
{{issue.summary.replace("Hello","Goodbye")}}
```

Swaps one word for another in a summary.

Result:

```
Goodbye World!
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.replaceAll("(lo)","xx$1yy")}}
```

Wraps the matched group with extra text by reusing it in the replacement.

Result:

```
Helxxloyy World!
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.replaceAll("(\w+) (\w+)","$2 $1")}}
```

Swaps the two words by naming the groups in a different order.

Result:

```
World Hello!
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.toLowerCase().replaceAll("[^a-z0-9]+","-")}}
```

Turns a summary into a slug for a URL or a branch name. Chains toLowerCase() and a character class.

Result:

```
hello-world-
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.remove(" ")}}
```

Deletes every space, for values that must be one word.

Result:

```
HelloWorld!
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.replace("Hello","Goodbye").replace("!","?")}}
```

Two replacements in a row, each working on the result of the one before.

Result:

```
Goodbye World?
```

Run on Jira Cloud on 29 Nov 2026.

## Pitfalls

- `replace()` is literal and `replaceAll()` is a regular expression. `replaceAll(".","-")` turned all 12 characters of Hello World! into dashes, while `replace(".","-")` changed nothing because the summary has no dot (checked on Jira Cloud, November 2026).
- Brackets are special in `replaceAll()`. With a summary of Hello World! (v2), `replaceAll("(v2)","X")` gave Hello World! (X), because the brackets were read as a group, while `replace("(v2)","X")` gave Hello World! X.
- All three are case sensitive. `replace("hello","Hi")` and `remove("L")` left Hello World! unchanged. Add `(?i)` at the start of a `replaceAll()` expression to ignore case.
- A lone dollar sign in the replacement is read as the start of a group reference, so replacing a letter with just that sign failed with a Failed to get value for error (checked on Jira Cloud, November 2026). The slug example also leaves a dash at the end when the title ends in punctuation.

## Questions and answers

### How do I use a matched group in the replacement?

Put the part to keep in round brackets in the expression and refer to it by number in the replacement, as the first example on this page does.

## Related

- [match()](https://goingstellar.ro/reference/smart-values/match/)
- [split()](https://goingstellar.ro/reference/smart-values/split/)
- [trim()](https://goingstellar.ro/reference/smart-values/trim/)
- [toLowerCase() and toUpperCase()](https://goingstellar.ro/reference/smart-values/tolowercase-touppercase/)
- [substringAfter(), substringBefore(), substringBetween()](https://goingstellar.ro/reference/smart-values/substringafter-substringbefore/)
- [htmlEncode, xmlEncode, jsonEncode and quote()](https://goingstellar.ro/reference/smart-values/htmlencode-xmlencode-jsonencode/)

## Sources

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

