Skip to content

Fix multiline regex#46298

Merged
SomeoneToIgnore merged 3 commits intozed-industries:mainfrom
Zachiah:ZS/fix-multiline-regex
Jan 8, 2026
Merged

Fix multiline regex#46298
SomeoneToIgnore merged 3 commits intozed-industries:mainfrom
Zachiah:ZS/fix-multiline-regex

Conversation

@Zachiah
Copy link
Collaborator

@Zachiah Zachiah commented Jan 7, 2026

Closes #45776

It didn't enable multiline mode before ¯\_(ツ)_/¯. If there is a reason this fix won't work please let me know but it seems like this one was just an easy fix.

Release Notes:

  • Improved multiline regex behavior

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 7, 2026
@zed-industries-bot

This comment was marked as resolved.

Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a way to add a test for this, is there not?

@@ -180,6 +180,10 @@ impl SearchQuery {
}

let multiline = query.contains('\n') || query.contains("\\n");
if multiline {
query.insert_str(0, "(?m)");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can there be a situation when a query already contains this?
Then, we'll spoil it by doing so?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a really good observation thanks! I just tested it and it works just the same as if you hadn't included it.

@SomeoneToIgnore SomeoneToIgnore self-assigned this Jan 8, 2026
@Zachiah
Copy link
Collaborator Author

Zachiah commented Jan 8, 2026

@SomeoneToIgnore Good catch. Just added a test. Thank you!

Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@SomeoneToIgnore SomeoneToIgnore merged commit f84f0ed into zed-industries:main Jan 8, 2026
23 checks passed
rtfeldman pushed a commit that referenced this pull request Jan 9, 2026
Closes #45776

It didn't enable multiline mode before `¯\_(ツ)_/¯`. If there is a reason
this fix won't work please let me know but it seems like this one was
just an easy fix.

Release Notes:
- Improved multiline regex behavior
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
Closes zed-industries#45776

It didn't enable multiline mode before `¯\_(ツ)_/¯`. If there is a reason
this fix won't work please let me know but it seems like this one was
just an easy fix.

Release Notes:
- Improved multiline regex behavior
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
Closes zed-industries#45776

It didn't enable multiline mode before `¯\_(ツ)_/¯`. If there is a reason
this fix won't work please let me know but it seems like this one was
just an easy fix.

Release Notes:
- Improved multiline regex behavior
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Feb 15, 2026
Closes zed-industries#45776

It didn't enable multiline mode before `¯\_(ツ)_/¯`. If there is a reason
this fix won't work please let me know but it seems like this one was
just an easy fix.

Release Notes:
- Improved multiline regex behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace empty lines with regex

3 participants