JSFiddle - React, Tailwind, and code Playground

by jfriend00

JavaScript

var str = "#r;\ntext1\n#r;\n#r;text2\n#r;";

var matches = str.match(/#r;\n(.*?)\n#r;/);
alert(matches[1]);