Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex Search and Replace All capture groups don't work when regex includes newline #80667

Closed
jdmoody opened this issue Sep 10, 2019 · 1 comment · Fixed by microsoft/azuredatastudio#7282
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug search Search widget and operation issues verified Verification succeeded

Comments

@jdmoody
Copy link

jdmoody commented Sep 10, 2019

Issue Type: Bug

  1. Create a new file with the following:
foo
bar baz
  1. Open the Search tab and add the following search (ensure "Use Regular Expression" is enabled):
foo\n(bar) baz
  1. Open the replace dropdown and use the following replace:
$1 baz
  1. Run "Replace All"

Expected: File text is replaced with bar baz
Actual: File text is replaced with $1 baz

What's odd is that this only happens for the actual Search tab. If I do the exact same search and replace inline for the file, it replaces the capture group correctly.

Also, the Search tab replaces capture groups properly when there's no newline. This bug only happens when the match contains a newline.

VS Code version: Code 1.38.0 (3db7e09, 2019-09-03T21:47:00.464Z)
OS version: Darwin x64 18.7.0

Extensions: none

@MrStanDu33
Copy link

This issue could be referenced in #9010.

When we look a this bug ($1 isn't referrencing group, just used as string "$1") we find #9010, it's a pain to find this #80667 issue.

Btw, glad you fixed it, you rocks guys ! 💪

@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug search Search widget and operation issues verified Verification succeeded
Projects
None yet
4 participants