JSFiddle - React, Tailwind, and code Playground

by brigand

HTML

<textarea name="" id="in_text" cols="30" rows="10">
# Header

Example

```js
foo
```

Other

```js
bar
```
</textarea>

<pre id="out"></pre>

CSS

textarea {
  height: 10m;
}

JavaScript

function tick() {
	const greedy = in_text.value.match(/```[^]*```/g);
	const non_greedy = in_text.value.match(/```[^]*?```/g);

	out.textContent = `Greedy:\n    ${greedy.join('\n<and another>\n')}\n\n${'-'.repeat(80)}\n\nNon-gredy:\n\n${non_greedy.join('\n<and another>\n')}`;
	requestAnimationFrame(tick);
}

tick();