简体   繁体   中英

Javascript regular expression that replaces html tags

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 and the <tr> tag

Thanks!!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM