{"id":20780115,"url":"https://github.com/xotic750/replace-x","last_synced_at":"2025-04-30T20:09:53.873Z","repository":{"id":19131343,"uuid":"86253279","full_name":"Xotic750/replace-x","owner":"Xotic750","description":"Command line search and replace utility.","archived":false,"fork":false,"pushed_at":"2023-01-07T07:56:16.000Z","size":4050,"stargazers_count":7,"open_issues_count":24,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-30T20:09:47.571Z","etag":null,"topics":["cli","files","javascript","nodejs","replace","search","sed"],"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/Xotic750.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-03-26T18:01:16.000Z","updated_at":"2022-06-07T03:25:26.000Z","dependencies_parsed_at":"2023-01-13T20:11:26.456Z","dependency_job_id":null,"html_url":"https://github.com/Xotic750/replace-x","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xotic750%2Freplace-x","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xotic750%2Freplace-x/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xotic750%2Freplace-x/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xotic750%2Freplace-x/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xotic750","download_url":"https://codeload.github.com/Xotic750/replace-x/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251774896,"owners_count":21641731,"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":["cli","files","javascript","nodejs","replace","search","sed"],"created_at":"2024-11-17T13:32:16.817Z","updated_at":"2025-04-30T20:09:53.842Z","avatar_url":"https://github.com/Xotic750.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca\n  href=\"https://travis-ci.org/Xotic750/replace-x\"\n  title=\"Travis status\"\u003e\n\u003cimg\n  src=\"https://travis-ci.org/Xotic750/replace-x.svg?branch=master\"\n  alt=\"Travis status\" height=\"18\"\u003e\n\u003c/a\u003e\n\u003ca\n  href=\"https://david-dm.org/Xotic750/replace-x\"\n  title=\"Dependency status\"\u003e\n\u003cimg src=\"https://david-dm.org/Xotic750/replace-x/status.svg\"\n  alt=\"Dependency status\" height=\"18\"/\u003e\n\u003c/a\u003e\n\u003ca\n  href=\"https://david-dm.org/Xotic750/replace-x?type=dev\"\n  title=\"devDependency status\"\u003e\n\u003cimg src=\"https://david-dm.org/Xotic750/replace-x/dev-status.svg\"\n  alt=\"devDependency status\" height=\"18\"/\u003e\n\u003c/a\u003e\n\u003ca\n  href=\"https://badge.fury.io/js/replace-x\"\n  title=\"npm version\"\u003e\n\u003cimg src=\"https://badge.fury.io/js/replace-x.svg\"\n  alt=\"npm version\" height=\"18\"\u003e\n\u003c/a\u003e\n\u003ca\n  href=\"https://bettercodehub.com/results/Xotic750/replace-x\"\n  title=\"bettercodehub score\"\u003e\n\u003cimg src=\"https://bettercodehub.com/edge/badge/Xotic750/replace-x?branch=master\"\n  alt=\"bettercodehub score\" height=\"18\"\u003e\n\u003c/a\u003e\n\u003ca\n  href=\"https://coveralls.io/github/Xotic750/replace-x?branch=master\"\n  title=\"Coverage Status\"\u003e\n\u003cimg src=\"https://coveralls.io/repos/github/Xotic750/replace-x/badge.svg?branch=master\"\n  alt=\"Coverage Status\" height=\"18\"\u003e\n\u003c/a\u003e\n\n# replace-x\n\n`replace-x` is a command line utility for performing in place 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- Uses [XRegExp](http://xregexp.com/) to provide augmented (and extensible) JavaScript regular expressions.\n\n# Install\n\nWith [node.js](http://nodejs.org/) and [npm](http://github.com/isaacs/npm):\n\n    npm install replace-x -g\n\nYou can now use `replace-x` and `search-x` from the command line.\n\n## Examples\n\nReplace all occurrences of \"foo\" with \"bar\" in files in the current directory:\n\n```\nreplace-x 'foo' 'bar' *\n```\n\nReplace in all files in a recursive search of the current directory:\n\n```\nreplace-x 'foo' 'bar' . -r\n```\n\nReplace-x only in test/file1.js and test/file2.js:\n\n```\nreplace-x 'foo' 'bar' test/file1.js test/file2.js\n```\n\nReplace-x all word pairs with \"\\_\" in middle with a \"-\":\n\n```\nreplace-x '(\\w+)_(\\w+)' '$1-$2' *\n```\n\nReplace only in files with names matching \\*.js:\n\n```\nreplace-x 'foo' 'bar' . -r --include=\"*.js\"\n```\n\nDon't replace in files with names matching _.min.js and _.py:\n\n```\nreplace-x 'foo' 'bar' . -r --exclude=\"*.min.js,*.py\"\n```\n\nPreview the replacements without modifying any files:\n\n```\nreplace-x 'foo' 'bar' . -r --preview\n```\n\nSee all the options:\n\n```\nreplace-x -h\n```\n\n## Search\n\nThere's also a `search-x` command. It's like `grep`, but with `replace-x`'s syntax.\n\n```\nsearch-x \"setTimeout\" . -r\n```\n\n## Programmatic Usage\n\nYou can use replace from your JS program:\n\n```javascript\nimport replace from 'replace-x';\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\n\nBy default, `replace-x` and `search-x` will exclude files (binaries, images, etc) that match patterns in the `\"defaultignore\"` located in this directory.\n\n### On huge directories\n\nIf `replace-x` 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## Limitations\n\n### Line length\n\nBy default, `replace-x` works on files with lines of 400 characters or less. If you need to work on long lines, gnu `sed` supports unlimited line length.\n\n### Symbolic links\n\nBy default, `replace-x` does not traverse symbolic links for files in directories.\n\n## What it looks like\n\n![replace-x](http://i.imgur.com/qmJjS.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxotic750%2Freplace-x","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxotic750%2Freplace-x","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxotic750%2Freplace-x/lists"}