Published
Edited
Apr 11, 2020
1 fork
1 star
Insert cell
Insert cell
text = "The rain in Spain";
Insert cell
expr = /\bS\w+/
Insert cell
matches = text.match(expr)
Insert cell
text.slice(matches.index)
Insert cell
text.replace(expr,"🇪🇸")
Insert cell
text2 = `
marc@faable.com
pedro @faable.com
estoy usando la @ en una frase de faable
faable.es
pericodelospalotes@faable.com
asdfasdffaable.comakshdgajhsdf
faablescom
pericodelospalotes_pedro_luis*53@faable.com
pedro@fable.com
pedro@faaable.com
pedro@faaaaaaaaable.com
@faable.com
MARC@FAABLE.COM
`
Insert cell
text2.match(/^\w+@fa{1,3}ble\.com$/gmi)
Insert cell
(/^\w+@fa{1,3}ble\.com$/gmi).toString()
Insert cell
domain = "faable"
Insert cell
text2.match(new RegExp(`^\\w+@${domain}\\.com$`,"gmi"))
Insert cell
md`## Capture Groups`
Insert cell
phoneNumber = /(?<prefix>\+34)?(?<number>.+)/
Insert cell
`+34293487291`.match(phoneNumber).groups
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