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

Multiline Find & Replace finds multiline string but substitutes $1 literally when replacing #80732

Closed
TSMMark opened this issue Sep 11, 2019 · 6 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster

Comments

@TSMMark
Copy link

TSMMark commented Sep 11, 2019

Possible related issue #63297

  • VSCode Version: 1.38.0
  • OS Version: Mac OSX 10.14.5

Steps to Reproduce:

  1. Search for a multiline pattern with a match group
    e.g.
    <Fragment>([\s\S\r]*)</Fragment>
    
  2. Enter replace with $1
    e.g.
    <>$1</>
    
  3. Run the replace and see that you get a literal $1 as the replace string
@vscodebot
Copy link

vscodebot bot commented Sep 11, 2019

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@alexdima
Copy link
Member

@TSMMark Is this in Search in Files (Ctrl+Shift+F) or Find in file (Ctrl+F) ?

@alexdima alexdima added the info-needed Issue requires more information from poster label Sep 13, 2019
@TSMMark
Copy link
Author

TSMMark commented Sep 13, 2019

The bug is present in in Search in Files: Ctrl+Shift+F / Cmd+Shift+F

Your question prompted me to try the same in Find in File Ctrl+F, and the bug is not present there! I guess I had unconsciously assumed they were backed by the same code. Good to know in case I need to work around it for now. Thanks @alexandrudima!

@miguel-bluefox
Copy link

Just tried it and got the same issue.

https://i.imgur.com/rd39fnN.png

If it works with Find in File but not in Search in Files, then maybe porting the code from Find in File over would be the easiest way to go about this? (Even better, merging the two so they use the same functionality/methods).

@roblourens
Copy link
Member

Dupe of #80667

@roblourens roblourens added the *duplicate Issue identified as a duplicate of another issue(s) label Sep 15, 2019
@TSMMark
Copy link
Author

TSMMark commented Sep 16, 2019

Fixed in 57f4855

Thanks!

@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
*duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants