Advertisement
SteamGear

Untitled

Jul 20th, 2020
1,428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Text.RegularExpressions;
  4.  
  5. namespace Uhrenfinder
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             string path = @"C:\Users\Dennis\Desktop\Liste.txt";
  12.             if (File.Exists(path))
  13.             {
  14.                 StreamReader stream = new StreamReader(path);
  15.                 StreamWriter writer = File.CreateText(@"C:\Users\Dennis\Desktop\Uhrenliste.txt");
  16.                 Regex reg = new Regex(@"(Uhr|uhr|Ur|ur|Ugur|ugur)");
  17.                 string current = "";
  18.                 while (stream.Peek() >= 0)
  19.                 {
  20.                     current = stream.ReadLine();
  21.                     if (reg.IsMatch(current))
  22.                     {
  23.                         Console.WriteLine(current);
  24.                         writer.WriteLine(current);
  25.                     }
  26.                 }
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement