I have table structure in HTML. I need to replace <tr>
with /n
and <td>
with '/t' using regex. What I have done is as follows:
var dataval = [].slice.call($("#printdiv").find("table tr")).map(function(row){
var a = row.textContent.trim().replace(/td/gi,"\t");
return a;
}).join("\r\n");
It is working partially but tab
is not coming between <td>
.