---
title: Rename one or multiple columns using a regular expression
description: ```
glaze yaml misc/test-data/test.yaml --input-is-array \
--rename-regexp '^(.*)bar:${1}blop'
```

doc_version: 1
last_updated: 2026-07-02
---

You can use one (or multiple) regexps to do column renames as well. 

You can even use capture groups and specify `$1` or `${1}` in the replacement 
string to expand the resulting column name with the expanded group.

Regexp replacements are performed after regular renames (because these 
are considered to be "exact" matches). 

Regular expression replacement are performed in order, and stop after the 
first match that actually modifies the column name.

---

```
❯ glaze yaml misc/test-data/test.yaml --input-is-array \
  --rename-regexp '^(.*)bar:${1}blop'
+-----+------+-----+-----+-----+---------+
| baz | blop | d.e | d.f | foo | fooblop |
+-----+------+-----+-----+-----+---------+
| 2   | 7    | 6   | 7   | 1   | [3 4 5] |
| 20  | 70   | 60  | 70  | 10  |         |
| 200 |      |     |     |     | [300]   |
+-----+------+-----+-----+-----+---------+
```

```
❯ glaze yaml misc/test-data/test.yaml --input-is-array \
  --rename-regexp '^(.*)bar:${1}blop','b..:blip'
+------+------+-----+-----+-----+---------+
| blip | blop | d.e | d.f | foo | fooblop |
+------+------+-----+-----+-----+---------+
| 2    | 7    | 6   | 7   | 1   | [3 4 5] |
| 20   | 70   | 60  | 70  | 10  |         |
| 200  |      |     |     |     | [300]   |
+------+------+-----+-----+-----+---------+
```