Published
Edited
Feb 8, 2021
1 star
Insert cell
Insert cell
wholeString = "Armanirmani"
Insert cell
searchString = 'ani'
Insert cell
myMatch = {
const myRegex = new RegExp(`(.*?)(${searchString})(.*)`, 'i');
return wholeString.match(myRegex);
}
Insert cell
{
const [_, before, search, after] = myMatch;
return html`${before}<b>${search}</b>${after}`
}
Insert cell
{
(option, userSearch) => {
const myRegex = new RegExp(`(.*?)(${userSearch})(.*)`, 'i');
const [_, before, search, after] = option.name.match(myRegex);
return [before, search, after]
}
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more