-2

私は以下のような文字列を持っています:

...[down]<a title="Download: Click Here" href="http://www.domain.com/T60B8JK2WT/" target="_blank"><strong> blah blah (2011)(1 - 22)</strong></a> <a title="Download: Click Here" href="http://www.domain.com/5FBLQYBQTV/" target="_blank"><strong> blah blah (2011) </strong></a>[/down]...

[down][/down]文字列からタグを見つけてすべてのhref属性を取得text of each linkし、[down][/down] タグに入れdata table、表の各行にタイトルと url フィールドを含めるにはどうすればよいですか?

ありがとう

4

1 に答える 1

0

コードは次のようになります。

foreach (Match match in Regex.Matches(inputString, 
                                      @"\[down\](?<content>.+)\[/down\]"))
{
    var content = match.Groups["content"].Value;

    var hrefs = new List<string>();

    foreach (Match matchhref in Regex.Matches(t, @"href=""(?<href>[^""]+)"""))
    {
        hrefs.Add(matchhref.Groups["href"].Value);
    }
}
于 2012-07-26T08:51:06.107 に答える