Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text.RegularExpressions;
- namespace ConsoleTests
- {
- class ConsoleTests
- {
- static void Main()
- {
- List<string> list = new List<string>();
- using (StreamReader reader = new StreamReader("file.txt"))
- {
- string line;
- while ((line = reader.ReadLine()) != null)
- {
- list.Add(line);
- }
- }
- foreach (var stuff in list)
- {
- string temp = ExtractHtmlInnerText(stuff);
- if (temp.Length!=0)
- {
- Console.WriteLine(temp);
- }
- }
- }
- public static string ExtractHtmlInnerText(string htmlText)
- {
- Regex regex = new Regex("(<.*?>\\s*)+", RegexOptions.Singleline);
- string resultText = regex.Replace(htmlText, " ").Trim();
- return resultText;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment