# Fix invalid regular expressions highlighting all search fields \(\#35001\) · gitcafe/zed

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

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

Visibility: public

Requested revision: fab450e39d39364ff6e2f08121c6d31e301a47ca

Requested commit: fab450e39d39364ff6e2f08121c6d31e301a47ca

Commit: fab450e39d39364ff6e2f08121c6d31e301a47ca

Tree: e1609cdb90d600e969cc09833b875ceeefc57aeb

Author: Peter Tripp

Committer: GitHub

## Message

```
Fix invalid regular expressions highlighting all search fields (#35001)

Closes https://github.com/zed-industries/zed/issues/34969
Closes https://github.com/zed-industries/zed/issues/34970

Only highlight the search field on regex error (buffer search and
project search).
Clear errors when the buffer search hidden so stale errors aren't shown
on next search.

Before (all fields highlighted red): 
<img width="631" height="180" alt="Screenshot 2025-07-23 at 22 59 45"
src="https://github.com/user-attachments/assets/a91d3090-1bae-4718-a1f5-0a1237559ff2"
/>

After (only query field highlighted red): 
<img width="632" height="187" alt="Screenshot 2025-07-23 at 23 10 49"
src="https://github.com/user-attachments/assets/6ae72c84-9333-4cdb-907b-afb7a0a6e808"
/>

Release Notes:

- Improved highlighting of regex errors in search dialogs
```

## Parents

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

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