Platform
Resources
Pricing
Sign in
Get started
nuandawm
Workspace
Fork
Published
By
nuandawm
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.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
wholeString
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
searchString
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
myMatch
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML