swichr
What is it?
An NPM module that allows you to replace all instances of a string with another (from an input file), while preserving casing & punctuation
How To Use
-
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')
Example
in.txt
This is a test where the word "where" appears in multiple cases. Where? Here, in this text file! WHERE? Here!
the replacing string: 'hi'
the string-to-be-replaced: 'where'
out.txt
This is a test hi the word "hi" appears in multiple cases. Hi? Here, in this text file! HI? Here!