# Improve Regex syntax highlighting \(\#25332\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/f4d1e7901cbf12cae5eab8c10eb0935855066747)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: f4d1e7901cbf12cae5eab8c10eb0935855066747

Requested commit: f4d1e7901cbf12cae5eab8c10eb0935855066747

Commit: f4d1e7901cbf12cae5eab8c10eb0935855066747

Tree: f7b1067b55a9b248e506db944cff112a598c85f6

Author: chbk

Committer: GitHub

## Message

````
Improve Regex syntax highlighting (#25332)

Release Notes:

  - Improved Regex syntax highlighting

| Zed 0.174.6 | With this PR |
| --- | --- |
|
![Image](https://github.com/user-attachments/assets/2a0bb1d9-cbba-490c-b2be-08c94bc79517)
|
![Image](https://github.com/user-attachments/assets/b19f3871-ee83-4165-a026-207bdbbcad44)
|

- `(?P=`, `<`: `punctuation.bracket`
- `group_name`: `property` -> `label`
- `^`, `$`: `string.escape` -> `operator`
- `\b`, `\B`, `\k`: `string.escape` -> `keyword.operator`
- added `regex` scope to target regex tokens specifically

```js
regex = /^(?<group>[!\.\?])\b[a-z]+word\k<group>$/g
```

---------

Co-authored-by: João Marcos <marcospb19@hotmail.com>
````

## Parents

- [044eb7b99048e79da5aa3f2dd489ff3ed8f97a32](https://git.cafe/gitcafe/zed/commit/044eb7b99048e79da5aa3f2dd489ff3ed8f97a32?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/f4d1e7901cbf12cae5eab8c10eb0935855066747?format=markdown)
