Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- namespace RegEx
- {
- class Program
- {
- static void Main(string[] args)
- {
- string email = "ivan@abvbg";
- string regex = @"^[a-zA-Z_0-9]+@[a-zA-Z]+\.[a-z]{2,3}$";
- Match m = Regex.Match(email, regex);
- if (m.Success)
- {
- Console.WriteLine("Valid email!");
- }
- else
- {
- Console.WriteLine("Invalid email!");
- }
- /*string doc = "Smith's number: 0898880022\nFranky can be " +
- " found at 0888445566.\nSteven’ mobile number: 0887654321";
- string replacedDoc = Regex.Replace(doc, "(08)[0-9]{8}", "$1********");
- Console.WriteLine(replacedDoc);*/
- /*string pattern = @"\b[M]\w+";
- Regex rg = new Regex(pattern);
- string authors = "Mahesh Chand, Raj Kumar, Mike Gold, Allen O'Neill, Marshal Troll";
- MatchCollection matchedAuthors = rg.Matches(authors);
- foreach (var item in matchedAuthors)
- {
- Console.WriteLine(item);
- }*/
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement