types
source
var types= new List<string>() { "Volvo", "Saab", }; string source = "This car is Volvo and the other one is Saab";
"This car is Volvo and the other one is Saab"
RegExp
function makeBold(source, types) { return source.replace(new RegExp('(\\b)(' + types.join('|') + ')(\\b)', 'ig'), '$1<bold>$2</bold>$3'); }
Quote:can you show me how?
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)