(html: string, tagName: string)
| 123 | } |
| 124 | |
| 125 | function removeElement(html: string, tagName: string): string { |
| 126 | return html.replace( |
| 127 | new RegExp(`<${tagName}\\b[^>]*>[\\s\\S]*?<\\/${tagName}>`, 'gi'), |
| 128 | '\n', |
| 129 | ) |
| 130 | } |
| 131 | |
| 132 | function extractElementContents(html: string, tagName: string): string[] { |
| 133 | const matches = html.matchAll( |