I want to match all strings between custom string, so here we go:
var string = `
<!--@hello-dear:John-->
<h1>John</h1>
<!--@bye-dear:John-->
`;
var startString = "<!--@hello-dear:John-->";
var endString = "<!--@bye-dear:John-->";
var regString = startString + "(.*?)" + endString;
var regex = new RegExp(regString, "i");
console.log(string.match(regex));
Returns null
Expected that matched object with the string
"<!--@hello-dear:John-->
<h1>John</h1>
<!--@bye-dear:John-->"