It is the very little part of HTML code, I want to get the all code wrapped by < ? and ? >.
Simply, I just want to extract the string given below. for example,
var code='<td>Total Response Sets</td><? if(byExposure) { ?><td style="text-align:right;padding-right:10px"><?= question.totals["control"] ?></td>';
// how to extract the required code with regular expression ?
After using npinti, I used below code, It gives me first expression between <% & %>. But How do I get next few expressions?
var patt=/<\?\s*(.*?)\s*\?>/g;
var result=patt.exec(code);
console.log(result[1]); // o/p -> if(byExposure) {
(For more info, Code is used for templating in underscore.js)