{"repo":"alexpovel/srgn","free":true,"listed":false,"github":"https://github.com/alexpovel/srgn","clone":"git clone https://github.com/alexpovel/srgn.git","description":"A grep-like tool which understands source code syntax and allows for manipulation in addition to search","language":"Rust","stars":908,"topics":["csharp","go","python","regex","rust","rust-lang","tree-sitter","typescript","abstract-syntax-tree","grep"],"license":"MIT","category":"cli-tools","readme_excerpt":"srgn - a code surgeon A grep -like tool which understands source code syntax and allows for manipulation in addition to search. Like grep , regular expressions are a core primitive. Unlike grep , additional capabilities allow for higher precision , with options for manipulation . This allows srgn to operate along dimensions regular expressions and IDE tooling ( Rename all , Find all references , ...) alone cannot, complementing them. srgn is organized around actions to take (if any), acting only within precise, optionally language grammar-aware scopes . In terms of existing tools, think of it as a mix of tr , sed , ripgrep and tree-sitter , with a design goal of simplicity : if you know regex and the basics of the language you are working with, you are good to go. The answer to \"What if grep , tr , sed and tree-sitter got really drunk one night and had a baby?\" -- Real Python Podcast Quick walkthrough [!TIP] All code snippets displayed here are verified as part of unit tests using the actual srgn binary. What is showcased here is guaranteed to work. The most simple srgn usage works similar to tr : Matches for the regular expression pattern '[wW]orld' (the scope ) are replaced (the action ) by the second positional argument. Zero or more actions can be specified: Replacement is always performed first and specified positionally. The argument goes last , disambiguated by -- for safety. Any other actions are applied after and given as command line flags. Multiple scopes Similarly","default_branch":null,"files":null,"tree":[],"storefront":"/r/alexpovel","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/alexpovel/srgn/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}