Skip to content

Replace all instances of a string with another (from an input file), while preserving casing & punctuation

Notifications You must be signed in to change notification settings

Nikhil22/swichr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  1. Require the swichr module
        const swichr = require('swichr');
        
  2. 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!

About

Replace all instances of a string with another (from an input file), while preserving casing & punctuation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published