your-tools / ruplacer

Find and replace text in source files
BSD 3-Clause "New" or "Revised" License
426 stars 25 forks source link

Replacement with empty string #68

Closed gpoore closed 3 years ago

gpoore commented 3 years ago

Thanks for creating ruplacer! It's been great for renaming variables across source files.

Is there a way to replace matches with the empty string? For example,

ruplacer "string" ""

fails with

error: The following required arguments were not provided:
    <replacement>

I've been working around this by just adding an empty capture group () and then replacing with '$1'.

dmerejkowsky commented 3 years ago

Sorry but I can't reproduce that bug here. What operating system and what kind of terminal are you using?

gpoore commented 3 years ago

I did some additional checking, and my issue is due to a longstanding bug in PowerShell:

So Ruplacer is working correctly...and now I have to worry about shell bugs whenever something doesn't work as expected!