piranha / goreplace

command line tool for search and replace
ISC License
185 stars 14 forks source link

Match placeholders in the replacement string with matched subgroups. #19

Closed tcard closed 10 years ago

tcard commented 10 years ago

goreplace '(Happy) (Christmas|Xmas)' -r '$1 ☃☃ $2 ☃☃'

So Happy Christmas turns into Happy ☃☃ Christmas ☃☃.

(There's a bunch of changes made by go fmt, I hope you don't care.)

piranha commented 10 years ago

Thanks a lot for a change! I've been meaning to do that since they introduced that in re, but totally forgot about it. And sure, I don't care about go fmt changes. :)