私はこのような文字列を持っています
文字列テキスト=
<p><span><span id="test">Meanwhile, the Cougars are coming off of a win against Eastern
Washington University in which they scored 88 points and had three players score at least
15 points. <span>Motum</span> recorded his fourth career double-double in the game as well.
</span></span></p>
<p><span>After Dexter Kernich-Drew, Royce Woolridge, and Will DiIorio were unable to
practice last Wednesday before the game against EWU, the team is healthy and ready to play
against Utah Valley. </span></p>
<p><span><span><span>Woolridge</span>, a <span>redshirt</span> sophomore transfer who has
started at guard in the first two games this season, scored seven points and had two assists
against EWU. He also had 10 points and three assists against Saint Martin’s. </span>
</span></p>
そして、属性がなく、コンテンツをラップしているだけのすべてのものを取り除く必要があります。私が今まで持っているパターンは
text = Regex.Replace(text, @"</?span([^>]*|/)?>", "", RegexOptions.Compiled);
すべてのスパンを引き出して残します
<p>Meanwhile, the Cougars are coming off of a win against Eastern Washington University
in which they scored 88 points and had three players score at least 15 points. Motum
recorded his fourth career double-double in the game as well. </p>
<p>After Dexter Kernich-Drew, Royce Woolridge, and Will DiIorio were unable to practice
last Wednesday before the game against EWU, the team is healthy and ready to play
against Utah Valley. </p>
<p>Woolridge, a redshirt sophomore transfer who has started at guard in the first
two games this season, scored seven points and had two assists against EWU. He also had
10 points and three assists against Saint Martin’s. </p>
それは近いですが、私は最初のものが必要でした
その中には次のように見えました
<p><span id="test">Meanwhile, the Cougars are coming off of a win against Eastern
Washington University in which they scored 88 points and had three players score at
least 15 points. Motum recorded his fourth career double-double in the game as well.
</span></p>
ここでの問題は、属性を持たないネストされたスパンを見つけて削除する方法です。終了タグにバックトレースを使用する他のいくつかの試行がありましたが、これが最も近い唯一の試行です。