开发者社区 问答 正文

Java 中如何用replaceAll()替换所有 html 标签?

Java 中如何用replaceAll()替换所有 html 标签?

展开
收起
vncamyi27xznk 2021-11-12 19:10:54 653 分享 版权
1 条回答
写回答
取消 提交回答
  • "//去除html标记 Pattern pattern = Pattern.compile(""<.+?>"", Pattern.DOTALL); Matcher matcher = pattern.matcher(""<a href=""index.html"">主页""); String string = matcher.replaceAll(""""); System.out.println(string);

    这本电子书收录于开发者藏经阁,下载链接:https://developer.aliyun.com/topic/download?id=923"

    2021-11-12 22:01:53
    赞同 展开评论