Home  >  Article  >  Backend Development  >  Detailed explanation of how to delete text in specified tags in UL and LI in C#

Detailed explanation of how to delete text in specified tags in UL and LI in C#

黄舟
黄舟Original
2017-06-04 09:43:061766browse

This article mainly introduces the method of C# to delete the text in the specified tag in UL LI, which involves C# regular matching and replacement of the page HTML element For related operating skills, friends in need can refer to

This article describes the method of deleting text in the specified tag in C# in C#. I share it with you for your reference. The details are as follows:

Now the demand is getting more and more abnormal, but we can only try to satisfy it when we make code. Here we first deduct the hyperlink in ul and li. Text

PromptHtml = GetData.GetHTTPInfo(Config.Prompt_Url, "utf-8");
PromptHtml = PromptHtml.Replace("
  • ", ""); PromptHtml=PromptHtml.Replace("
", ""); string ss = @"]*?>([\s\S]*?)"; //这里 MatchCollection mcTable = Regex.Matches(PromptHtml, ss); foreach (Match mTable in mcTable) { if (mTable.Success) { PromptHtml = mTable.Groups[2].Value; } } resultHtml = PromptHtml;

The specific data source is as follows:

The code is as follows:

This article deducts the text in span in ul and li:

middlebannerHtml = GetData.GetHTTPInfo(Config.Middlebanner_Url, "utf-8");
middlebannerHtml = middlebannerHtml.Replace("
  • ", ""); middlebannerHtml = middlebannerHtml.Replace("
", ""); string ss = @"([^<]+)"; //这里 MatchCollection mcTable = Regex.Matches(middlebannerHtml, ss); foreach (Match mTable in mcTable) { if (mTable.Success) { middlebannerHtml = mTable.Groups[1].Value; } } middleContent = middlebannerHtml;

The specific data source is as follows:

The code is as follows:


The above is the detailed content of Detailed explanation of how to delete text in specified tags in UL and LI in C#. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn