我有这样的片段执行正则表达式搜索:正则表达式:反转匹配顺序
public IEnumerable<MyMatch> GetMyMatches()
{
Match m = myRegex.Match(Text, offset);
if (m != null && m.Success && m.Value != null && m.Value.Length > 0)
{
offset = m.Index+m.Length;
yield return new MyMatch() { Match=m, SomeFurtherInformation=... };
} else
yield break;
}
正如你所看到的,我走所有occourences在我的文字。
但如何反转搜索方向?
感谢您的帮助
注意:m!= null始终为真,m.Value!= null也是如此,除非有例外(比如偏移量太大)但是没有m :-)如果没有匹配,则Value = =“”。 – xanatos