Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 获取内部价值观<;td>;标签_C#_Html_Regex - Fatal编程技术网

C# 获取内部价值观<;td>;标签

C# 获取内部价值观<;td>;标签,c#,html,regex,C#,Html,Regex,可变HTML标记: <td class="center line"><strong>Banana</strong></td> <td class="center line red"><strong>(Apple)</strong></td> <td class="center">Orange</td> <td class="center red">Cherry<

可变HTML标记:

<td class="center line"><strong>Banana</strong></td>
<td class="center line red"><strong>(Apple)</strong></td>
<td class="center">Orange</td>
<td class="center red">Cherry</td>
香蕉 (苹果) 橙色 樱桃 这是行不通的

<td class=\"center[ line]?[ red]?\">[<strong>]?[(]?[A-Za-z]*[)]?[</strong>]?</td>
[]?[(]?[A-Za-z]*[)]?[]?
行、红色、强标记为常量


救命啊

您可以尝试使用下面的正则表达式来匹配上述四行

<td\s*class=\"center(?: line(?: red)?| red)?\">(?:<strong>)?\(?[A-Za-z0-9]*\)?(?:<\/strong>)?<\/td>
(?:)?\(?[A-Za-z0-9]*\)(?:)?


使用非捕获组或捕获组而不是
[line]?
行作为可选行。它可能是
(行)
(?:行)

使用
(行)
(红色)
等。相反,使用XML解析器。