{"id":17659745,"url":"https://github.com/raphamorim/node-replace","last_synced_at":"2025-05-07T15:01:51.496Z","repository":{"id":57311692,"uuid":"108065259","full_name":"raphamorim/node-replace","owner":"raphamorim","description":"Maintaned Fork from harthur/replace","archived":false,"fork":false,"pushed_at":"2017-10-24T02:23:53.000Z","size":57,"stargazers_count":7,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-25T01:24:34.424Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raphamorim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-24T02:11:49.000Z","updated_at":"2018-12-03T13:17:40.000Z","dependencies_parsed_at":"2022-08-23T14:00:17.191Z","dependency_job_id":null,"html_url":"https://github.com/raphamorim/node-replace","commit_stats":{"total_commits":69,"total_committers":14,"mean_commits":4.928571428571429,"dds":"0.26086956521739135","last_synced_commit":"62e85053bade1d23dc5765d46fa3d980787c9e57"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fnode-replace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fnode-replace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fnode-replace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphamorim%2Fnode-replace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raphamorim","download_url":"https://codeload.github.com/raphamorim/node-replace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252902604,"owners_count":21822259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-23T16:08:10.314Z","updated_at":"2025-05-07T15:01:51.384Z","avatar_url":"https://github.com/raphamorim.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-replace\n\n\u003e Maintaned Fork from [harthur/replace](https://github.com/harthur/replace)\n\n`replace` is a command line utility for performing search-and-replace on files. It's similar to sed but there are a few differences:\n\n* Modifies files when matches are found\n* Recursive search on directories with -r\n* Uses [JavaScript syntax](https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions#Using_Simple_Patterns) for regular expressions and [replacement strings](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter).\n\n# Install\nWith [node.js](http://nodejs.org/) and [npm](http://github.com/isaacs/npm):\n\n\tnpm install node-replace -g\n\nYou can now use `replace` and `search` from the command line.\n\n\n## Examples\n\nReplace all occurrences of \"foo\" with \"bar\" in files in the current directory:\n\n```\nreplace 'foo' 'bar' *\n```\n\nReplace in all files in a recursive search of the current directory:\n\n```\nreplace 'foo' 'bar' . -r\n```\n\nReplace only in test/file1.js and test/file2.js:\n\n```\nreplace 'foo' 'bar' test/file1.js test/file2.js\n```\n\nReplace all word pairs with \"_\" in middle with a \"-\":\n\n```\nreplace '(\\w+)_(\\w+)' '$1-$2' *\n```\n\nReplace only in files with names matching *.js:\n\n```\nreplace 'foo' 'bar' . -r --include=\"*.js\"\n```\n\nDon't replace in files with names matching *.min.js and *.py:\n\n```\nreplace 'foo' 'bar' . -r --exclude=\"*.min.js,*.py\"\n```\n\nPreview the replacements without modifying any files:\n\n```\nreplace 'foo' 'bar' . -r --preview\n```\n\nSee all the options:\n\n```\nreplace -h\n```\n\n## Search\nThere's also a `search` command. It's like `grep`, but with `replace`'s syntax.\n\n```\nsearch \"setTimeout\" . -r\n```\n\n## Programmatic Usage\nYou can use replace from your JS program:\n\n```javascript\nvar replace = require(\"node-replace\");\n\nreplace({\n  regex: \"foo\",\n  replacement: \"bar\",\n  paths: ['.'],\n  recursive: true,\n  silent: true,\n});\n```\n\n## More Details\n\n### Excludes\nBy default, `replace` and `search` will exclude files (binaries, images, etc) that match patterns in the `\"defaultignore\"` located in this directory.\n\n### On huge directories\nIf `replace` is taking too long on a large directory, try turning on the quiet flag with `-q`, only including the necessary file types with `--include` or limiting the lines shown in a preview with `-n`.\n\n\n## What it looks like\n![replace](http://i.imgur.com/qmJjS.png)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphamorim%2Fnode-replace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraphamorim%2Fnode-replace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphamorim%2Fnode-replace/lists"}