ASP.net REGEX问题:查找特定匹配,然后跳过所有结束标记

时间:2009-04-06 02:05:01

标签: regex

strRegex = New StringBuilder
strRegex.Append("<td class=""[\s\w\W]*?"">(?<strTKOWins>[^<]+)[\s]*?<span  
                 class='[\s\w\W]*?'>(T)KOs[\s\w\W]*?</span>[\s\S]*</td>")
                Regex = New System.Text.RegularExpressions.Regex(strRegex.ToString, 
                RegexOptions.None)
Matches = Regex.Match(results, strRegex.ToString)

这是我的代码。我想要匹配:

[?什么 ?请在此插入您想要匹配的内容]

问题是在SPAN标记结束后,我想跳过表格单元格内的所有内容,并一直跳到结束标记</td>

我该怎么做?

1 个答案:

答案 0 :(得分:0)

我不知道你要做什么。但是这个正则表达式会找到一个tablecell,其中有一个span,然后转到相应的结束标记。填写您需要的所有细节,并根据需要进行更改....

例如,

文本:

<td class="td class"> anything at all in here?! <span class="span class">span text</span>text in the tablecell?</td>

正则表达式:

<td\s+class=".*?">.*?<span\s+class=".*?">.*?</span>.*?</td>

不知道所有这些“strTKOWins”废话是什么,或者你是否想要在你的跨度中找到特定的东西?

(T)KOs[\s\w\W]*?

我猜你无论如何都无法提供帮助....