Skip to content
Replace matching strings and regexes in files
Branch: master
Clone or download
Pull request Compare This branch is even with sindresorhus:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
.editorconfig
.gitattributes
.gitignore
.npmrc
.travis.yml
api.js
cli.js
license
package.json
readme.md
test.js

readme.md

replace-in-files-cli Build Status

Replace matching strings and regexes in files

Install

$ npm install --global replace-in-files-cli

Usage

$ replace-in-files --help

  Usage
    $ replace-in-files <files…>

  Options
    --regex           Regex pattern to find  (Can be set multiple times)
    --string          String to find  (Can be set multiple times)
    --replacement     Replacement string  (Required)
    --ignore-case     Search case-insensitively

  Examples
    $ replace-in-files --string='horse' --regex='unicorn|rainbow' --replacement='🦄' foo.md
    $ replace-in-files --regex='v\d+\.\d+\.\d+' --replacement=v$npm_package_version foo.css

  You can use the same replacement patterns as with `String#replace()`, like `$&`.

Real-world use-case: Bumping version number in a file when publishing to npm

You can’t perform that action at this time.