{"library":"replace","title":"Command Line Search and Replace Utility","description":"The `replace` utility is a command-line tool for performing search-and-replace operations across multiple files. It functions similarly to `sed` but distinguishes itself by directly modifying files when matches are found, offering recursive directory search capabilities, and leveraging JavaScript syntax for regular expressions and replacement strings. Additionally, it provides a `search` command that mimics `grep`'s functionality, utilizing the same JS-based regex patterns. The current stable version is 1.2.2. While its release cadence isn't explicitly defined, the version number suggests a mature, stable tool with infrequent updates. Its key differentiators include its direct file modification approach, ease of recursive operations, and the familiarity of JavaScript regex for developers. It also offers a programmatic API for integration into Node.js applications and includes default and customizable file exclusion patterns.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install replace"],"cli":{"name":"replace","version":null}},"imports":["const replace = require('replace');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const replace = require('replace');\n\n// Example: Replace 'old_text' with 'new_text' in all .js files in a specific directory recursively\nreplace({\n  regex: 'old_text',\n  replacement: 'new_text',\n  paths: ['./my-project-folder/'], // Specify the directory or files to search\n  recursive: true,\n  silent: false, // Set to true to suppress console output\n  // You can also add includes/excludes like:\n  // include: '*.js',\n  // exclude: '*.min.js'\n});\n\nconsole.log('Replacement process initiated.');\n// Note: replace is asynchronous but doesn't return a Promise or take a callback directly for completion. \n// For robust programmatic use, consider wrapping it in a Promise or handling file system events if precise timing is needed.","lang":"javascript","description":"Demonstrates programmatic search and replace within a specified directory using JavaScript regular expression syntax.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}