开发者

Javascript regular expression that replaces html tags

开发者 https://www.devze.com 2023-04-11 00:27 出处:网络
I want to use a regular expression in javascript to replace all occurances of </tr><tr> with

I want to use a regular expression in javascript to replace all occurances of

</tr><tr>

with

<td>&nbsp;&nbsp;</td>

Also, there can be whitespace between the </tr> tag 开发者_StackOverflow中文版and the <tr> tag

Thanks!!


result = subject.replace(/<\/tr>\s*<tr>/g, "<td>&nbsp;&nbsp;</td>");
0

精彩评论

暂无评论...
验证码 换一张
取 消