Regular Expression, JEditorPane, Self-closing tags
Posted
by Stephen Swensen
on Stack Overflow
See other posts from Stack Overflow
or by Stephen Swensen
Published on 2010-04-02T15:15:51Z
Indexed on
2010/04/02
15:23 UTC
Read the original article
Hit count: 438
I'm am using JEditorPane to render basic HTML. But it renders self-closing tags incorrectly, specifically br tags, e.g. <br /> is bad but <br> is good. I would like to use String.replaceAll(regex, "<br>") to fix the HTML, where regex is a regular expression matching any self-closing br tag with case-insensitivity and zero to infinity number of spaces between the "r" and the "/" (e.g., <br/>, <BR/>, <br />, <Br />, etc.).
Thanks to any regular expression experts who can solve this!
© Stack Overflow or respective owner