So this is purely a question of curiosity...
Say I have a set of tags:
<tag>
<sub>A</sub>
<sub>B</sub>
<sub>C</sub>
</tag>
<tag>
<sub>1</sub>
<sub>2</sub>
<sub>3</sub>
</tag>
Is it possible to, in a single Regex.Replace
command, aggregate the contents of all <sub>
tags within a <tag>
into one <sub>
.
Like so:
<tag><sub>ABC</sub></tag>
<tag开发者_如何学Go><sub>123</sub></tag>
My guess is no, but I figured I'd give it a shot.
Is the theoretical tag set always this clean? If so, replacing </sub>\s+<sub>
with nothing would do it.
精彩评论