Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Net;
- using System.Text.RegularExpressions;
- namespace Рофл
- {
- internal class Program
- {
- public static void Main(string[] args)
- {
- Regex rx = new Regex(@"[a-я]{5,}");
- string str = "Здесь много букв, и те, где больше 5 или 5 будут выведены.";
- foreach (var temp in rx.Matches(str))
- {
- Console.WriteLine(temp);
- }
- // Теперь поменяем регулярное выражение для этого
- // надо просто переслздать Regex rx, т.е.
- rx = new Regex(@"[A-z0-9]*@[a-z]+\.[a-z]{2,5}"); // Указываем новое регулярное выражение
- str = "po4ta@ya.ru";
- if (rx.IsMatch(str))
- {
- Console.WriteLine("Подходит!");
- }
- else
- {
- Console.WriteLine("Не подходит");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement