Skip to content
add specified tags, brackets, or whatevs to all matching substring instances within a string
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
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

Something went wrong with that request. Please try again.