DEV Community

Discussion on: How to normalize (join together) bold nodes in HTML DOM?

Collapse
 
6temes profile image
Daniel

Using Regex to parse and manipulate HTML is a recipe for disaster. There are too many edge cases you have to account for.

If you really want to "optimize" the HTML, you may end up having to parse HTML into some kind of AST and work from there. But this is probably more complex than the editor itself you want to build.

Collapse
 
pulljosh profile image
Josh Pullen

But parsing html with regex is fun...

Collapse
 
6temes profile image
Daniel

Not as much as having dinner at home. ;)