Published
Edited
Sep 18, 2021
1 fork
Insert cell
# Online text utils 2
Insert cell
// ... for an array of strings
Insert cell
//
Insert cell
# (test data)
Insert cell
Insert cell
# please choose an input file


Insert cell
viewof textfilename2 = html`<input type=file >`

Insert cell
text2=Files.text(textfilename2)
Insert cell
inputarray2=text2.split('\n')
Insert cell
# (you can download any text or json by clicking on the left)
Insert cell
filter1out.join('\n')
Insert cell
//
Insert cell
# filter 1
Insert cell
filter1exp=/095/ // /[:] 94/i
Insert cell
md`### (do not use /g in a regex here)`
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test
// Using test() on a regex with the "global" flag


Insert cell
filter1in=inputarray1
Insert cell
filter1out=filter1in.filter(line => filter1exp.test(line));

Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
////hstd1=html`<textarea class="form-control2" id=std1 ></textarea>`
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