Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Исходная строка – 10000 символов из романа «Война и мир», искомая строка: а) «князь» б) «императрица»
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- using System.Text.RegularExpressions;
- namespace ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- StreamReader input = new StreamReader("e:/practice/input.txt", Encoding.GetEncoding(1251));
- string text = input.ReadToEnd();
- input.Close();
- Regex rex = new Regex (@"\d{1,3}\.\d{1,3}\.\d{1,3}\.d{1,3}");
- MatchCollection arr = rex.Matches(text);
- StreamWriter output = new StreamWriter("e:/practice/output.txt", false);
- output.WriteLine("Найденные IP: ");
- foreach (Match el in arr) {
- output.WriteLine(el);
- }
- output.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement