UNPKG

971 BMarkdownView Raw
1# replaceall [![Build Status](https://travis-ci.org/leecrossley/replaceall.png?branch=master)](https://travis-ci.org/leecrossley/replaceall) [![npm version](https://badge.fury.io/js/replaceall.png)](https://npmjs.org/package/replaceall) [![devDependency Status](https://david-dm.org/leecrossley/replaceall/dev-status.png)](https://david-dm.org/leecrossley/replaceall#info=devDependencies)
2
3Replace all instances in a JavaScript string.
4
5### Install with npm
6
7```
8npm install replaceall
9```
10
11To then include replaceall in your node app:
12
13```
14var replaceall = require("replaceall");
15```
16
17### Using replaceall
18
19```js
20var result = replaceall("instances of this", "with this string", "in this string");
21```
22
23### Example
24
25```js
26var original = "hello world goodbye world";
27
28replaceall("world", "everyone", original);
29// "hello everyone goodbye everyone"
30
31replaceall("l", "z", original);
32// "hezzo worzd goodbye worzd"
33```
34
35## License
36
37[MIT License](http://ilee.mit-license.org)