Public
Edited
Feb 9, 2023
Insert cell
Insert cell
// this regex matches a single character from a set (the chars in the square brackets)
re = /^[%#.*-]$/
Insert cell
// we could also do it this way but its more verbose than a regex
matches = (char) => char.length === 1 && characters.includes(char)
Insert cell
characters = "#.%-*+"
Insert cell
matches("*")
Insert cell
matches(".")
Insert cell
matches("##")
Insert cell
matches("something.really.long")
Insert cell
re.test("*")
Insert cell
re.test("#")
Insert cell
re.test(".")
Insert cell
re.test("-")
Insert cell
re.test("should.not.match#this%right?")
Insert cell
re.test("*.")
Insert cell
re.test(".a")
Insert cell
re.test("*b*")
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