Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- namespace Regular_Expression
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] sites = {
- "http://www.google.com",
- "https://www.google.com",
- "http://google.com",
- "www.google.com",
- "google.com"
- };
- for (int i = 0; i < sites.Length; i++)
- {
- string pattern = @"(http)?(s)?(://)?(w{3}\.)?\w+\.\w+";
- bool ismatch = Regex.IsMatch(sites[i], pattern);
- Console.WriteLine(ismatch);
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement