我需要以这种格式粘贴一个文本文件:
[section A begin]
some lines
more lines
[section 1 begin]
some lines
[section i begin]
some lines
[section i end]
more lines
[section 1 end]
more lines
[section A end]
[section B end]
...
[section B end]
每个部分有 1 个开始标签和 1 个结束标签;这些部分可以嵌套,但不能交错;该文件可能很大,无法在内存中整体读取。
问题:解析此类文件的最简单方法是什么(任何要使用的开源库)?