Regex to Indent an XML File

前端 未结 7 1911
攒了一身酷
攒了一身酷 2020-12-21 06:14

Is it possible to write a REGEX (search replace) that when run on an XML string will output that XML string indented nicely?

If so whats the REGEX :)

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-21 06:50

    This would only be acheivable with multiple regexs, which will perform like a state machine.

    What you are looking for is far better suited to an off the cuff parser.

提交回复
热议问题