Java regex to strip out XML tags, but not tag contents

前端 未结 6 1595
有刺的猬
有刺的猬 2021-02-08 13:37

I have the following Java code:

str = str.replaceAll(\"<.*?>.*?|<.*?/>\", \"\");

This turns a String like so:



        
6条回答
  •  悲&欢浪女
    2021-02-08 14:01

    If you want to parse XML log file so you can do with regex {java}, <[^<]+<.so you get DEV. Output like name>DEV. You have to just play with REGEX.

提交回复
热议问题