2
我想在开始时分割文本,并结束一些标签(div和p)不是全部。在Java中使用正则表达式分割字符串
Input:
String html = "text<div>some text</div><tag>text</tag><span>asd</span><p>text</p>text";
Output:
text
<div>some text</div>
<tag>text</tag><span>asd</span>
<p>text</p>
text
我应该使用哪个正则表达式?
一个名为HTML解析器的正则表达式。 – m0skit0
另请参阅http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 –
尝试使用像JSoup的HTML解析 – selig