An NPM module that allows you to replace all instances of a string with another (from an input file), while preserving casing & punctuation
-
Require the swichr module
const swichr = require('swichr');
-
Pass in (as arguments):
- a path to your input file
- a path to your output file
- the replacing string
- the string-to-be-replaced
swichr('in.txt', 'out.txt', 'hi', 'where')
This is a test where the word "where" appears in multiple cases. Where? Here, in this text file! WHERE? Here!
This is a test hi the word "hi" appears in multiple cases. Hi? Here, in this text file! HI? Here!