搜索betwen htm标签c#

本文关键字:标签 htm betwen 搜索 | 更新日期: 2023-09-27 18:27:58

如何从html标签中获取信息?我想在html代码中搜索一个示例writeby并重试结果

类似于第一行

<th scope="row">Written&#160;by</th>

阿达奇托卡得到这个作者:Adachitoka这是我的html代码:

<td colspan="2" style="text-align:center;background:#CCF; font-weight:bold;">Manga</td>
</tr>
<tr>
<th scope="row">Written&#160;by</th>
<td>Adachitoka</td>
</tr>
<tr>
<th scope="row">Published&#160;by</th>
<td><a href="/wiki/Kodansha" title="Kodansha">Kodansha</a></td>
</tr>
<tr>
<th scope="row">English publisher</th>
<td>
<div style="overflow:hidden; width:100%;">
<div style="width:1.5em; float:left;"><small><sup style="font-style:normal;"><a href="/wiki/Northern_America" title="Northern America">NA</a></sup></small></div>
<div style="margin-left:1.5em;"><a href="/wiki/Kodansha_Comics_USA" title="Kodansha Comics USA">Kodansha Comics USA</a></div>
</div>
</td>
</tr>
<tr>
<th scope="row">Demographic</th>
<td><i><a href="/wiki/Sh%C5%8Dnen_manga" title="Shōnen manga">Shōnen</a></i></td>
</tr>
<tr>
<th scope="row">Magazine</th>
<td><i><a href="/wiki/Monthly_Sh%C5%8Dnen_Magazine" title="Monthly Shōnen Magazine">Monthly Shōnen Magazine</a><br />
Monthly Shōnen Magazine +</i></td>
</tr>
<tr>
<th scope="row">Original run</th>
<td><span class="nowrap">December 6, 2010</span> – ongoing</td>
</tr>
<tr>
<th scope="row">Volumes</th>
<td>15 + 1 special <span class="noprint">(<a href="/wiki/List_of_Noragami_chapters" title="List of Noragami chapters">List of volumes</a>)</span></td>
</tr>
<tr>
<td colspan="2" style="text-align:center;background:#CCF; font-weight:bold;">Anime television series</td>
</tr>
<tr>
<th scope="row">Directed&#160;by</th>
<td>Kotaro Tamura</td>
</tr>
<tr>
<th scope="row">Written&#160;by</th>
<td>Deko Akao</td>
</tr>
<tr>
<th scope="row">Music&#160;by</th>
<td><a href="/wiki/Taku_Iwasaki" title="Taku Iwasaki">Taku Iwasaki</a></td>
</tr>
<tr>
<th scope="row">Studio</th>
<td><a href="/wiki/Bones_(studio)" title="Bones (studio)">Bones</a></td>
</tr>
<tr>
<th scope="row">Licensed&#160;by</th>
<td>
<div style="overflow:hidden; width:100%;">
<div style="width:1.7em; float:left;"><small><sup style="font-style:normal;"><a href="/wiki/Australasia" title="Australasia">AUS</a></sup></small></div>
<div style="margin-left:1.5em;"><a href="/wiki/Madman_Entertainment" title="Madman Entertainment">Madman Entertainment</a></div>
</div>
<div style="overflow:hidden; width:100%;">
<div style="width:1.5em; float:left;"><small><sup style="font-style:normal;"><a href="/wiki/Northern_America" title="Northern America">NA</a></sup></small></div>
<div style="margin-left:1.5em;"><a href="/wiki/Funimation" title="Funimation">Funimation</a></div>
</div>
<div style="overflow:hidden; width:100%;">
<div style="width:1.5em; float:left;"><small><sup style="font-style:normal;"><a href="/wiki/United_Kingdom" title="United Kingdom">UK</a></sup></small></div>
<div style="margin-left:1.5em;"><a href="/wiki/Manga_Entertainment" title="Manga Entertainment">Manga Entertainment</a></div>
</div>
</td>
</tr>
<tr>
<th scope="row">Network</th>
<td><a href="/wiki/Tokyo_MX" title="Tokyo MX" class="mw-redirect">Tokyo MX</a>, <a href="/wiki/Mainichi_Broadcasting_System" title="Mainichi Broadcasting System">MBS</a>, <a href="/wiki/Nippon_BS_Broadcasting" title="Nippon BS Broadcasting">BS11</a>, <a href="/wiki/Television_Aichi_Broadcasting" title="Television Aichi Broadcasting">TVA</a></td>
</tr>
<tr>
<th scope="row">Original run</th>
<td><span class="nowrap">January 5, 2014</span> – <span class="nowrap">March 23, 2014</span></td>
</tr>
<tr>
<th scope="row">Episodes</th>
<td>12 <span class="noprint">(<a href="/wiki/List_of_Noragami_episodes#Season_1" title="List of Noragami episodes">List of episodes</a>)</span></td>
</tr>
<tr>
<td colspan="2" style="text-align:center;background:#CCF; font-weight:bold;"><a href="/wiki/Original_animation_DVD" title="Original animation DVD" class="mw-redirect">Original animation DVD</a></td>
</tr>
<tr>
<th scope="row">Directed&#160;by</th>
<td>Kotaro Tamura</td>
</tr>
<tr>
<th scope="row">Written&#160;by</th>
<td>Deko Akao</td>
</tr>
<tr>
<th scope="row">Music&#160;by</th>
<td><a href="/wiki/Taku_Iwasaki" title="Taku Iwasaki">Taku Iwasaki</a></td>
</tr>
<tr>
<th scope="row">Studio</th>
<td><a href="/wiki/Bones_(studio)" title="Bones (studio)">Bones</a></td>
</tr>
<tr>
<th scope="row">Released</th>
<td><span class="nowrap">February 17, 2014</span> – <span class="nowrap">July 17, 2014</span></td>
</tr>
<tr>
<th scope="row">Episodes</th>
<td>2</td>
</tr>
<tr>

搜索betwen htm标签c#

不要在html上执行任何类型的字符串搜索。Html具有嵌套结构,并且可以包含编码字符。Regex会失败,或者至少会变得过于复杂。也不要将html视为XML。Html可能包含不匹配的标记。

最好的方法是Html敏捷包。它非常宽容,可以处理未关闭的标签和其他奇怪的事情。