Hi, I would like help creating a regex that replaces all html tags, but when the ending div and the beginning div are next to each other, it adds a space, like
This<b>is</b> <div>a</div><div>test</div>
This is a test
My current regex is /(<([^>] )>)/ig which will replace all html tags but I want to know whenever there is a closing div and the following opening div How to add a space to each other.
I tried replacing the valid html with /(<([^>] )>)/ig but I need help with the spacing of the divs when they are next to each other
JS has built-in support for HTML parsing. Use this instead:
try it: