I have some text in the
tags such like
<p>This is text a</p><p>This is text ended without p</a>
I want to use Regex to match both classes and extract InnerText:
const string patternDesp = @"<p>(.+?)(</p>|</a>)";
But when I look at the m.Groups[1]
, it only returns 1 match. m.Groups[2]
gives me
</a>
我已经解决了这个问题,似乎我需要使用MatchCollection
而不是Match
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.