TL;DR — Quick Summary
comby searches and replaces code structurally — respecting syntax, strings, and comments. Beyond regex, it understands code structure.
comby replaces code structurally — it understands brackets, strings, and comments. Beyond regex.
Installation
# Homebrew
brew install comby
# Official installer
bash <(curl -sL get.comby.dev)
# Docker
docker run -it comby/comby
Usage
# Search for console.log calls
comby 'console.log(:[args])' '' -matcher .js -d src/
# Replace function signature
comby 'function :[name](:[args])' 'const :[name] = (:[args]) =>' -matcher .js
# Rename a method across files
comby ':[obj].oldMethod(:[args])' ':[obj].newMethod(:[args])' -d src/
# Multi-line matching
comby 'if (:[cond]) { :[body] }' 'when (:[cond]) { :[body] }' -matcher .kt
# Apply changes in-place
comby 'var :[x]' 'let :[x]' -matcher .js -in-place -d src/
Summary
- comby: structural code search and replace
- Understands brackets, strings, comments
- 30+ language support
- Dry-run diffs by default — safe refactoring
- Wildcard :[holes] for flexible matching