jquery - Can't remove place holders with regular expression in Javascript -
i have dynamically created table containing redundant place holders remove, this:
{firm[i][j]} //i,j numbers
i trying regular expression in javascript doesn't work, here regular expression, table below string inserted dom.
var table = " <table class='table table-sm' style='margin:auto;'> <thead> <tr> <th colspan='5'>qarelease</th> </tr> </thead> <tbody> <tr style='text-align:left;'> <td width='25%;'>{firm[i][j]}</td> <td width='25%;'>{firm[i][j]}</td> <td width='25%;'>{firm[i][j]}</td> <td width='25%;'>{firm[i][j]}</td> </tr> </tbody> </table>"
regular expression:
table = table.replace(/{firm[\d{1}][\d{1}]}/g, "");
not quite sure why couldn't work
if trying match [] too, need escape them:
table = table.replace(/{firm\[\d{1}\]\[\d{1}\]}/g, "");
Comments
Post a Comment