add specified tags, brackets, or whatevs to all matching substring instances within a string
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
History.md
Makefile
Readme.md
component.json
example.html
index.js

Readme.md

string-highlight

add specified tags to matching all substr instances within a string

Installation

Install with component(1):

$ component install bmcmahen/string-highlight

Example

var el = document.getElementById('bold-me');
var str = el.innerText;
var highlight = require('string-highlight');
var altered = highlight(str, 'ben', '<b>', '</b>');
el.innerHTML = altered;

License

MIT