using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^(?:https?:\/\/)?(?:www\.)?[\d\w\.-]+(?:\.|:)(?:[a-z\.]{2,6}|\d+)\/?.*$";
string input = @"https://regex101.com/
https://www.variables.sh/complex-regular-expression-examples
https://search.brave.com/search?q=regex+challenges&source=desktop
https://web.whatsapp.com/
https://www.youtube.com/watch?v=fc_RvxTtIwc
https://text-auditor.netlify.app/
https://github.com/Dashrath-Sharma
http://github.com/Dashrath-Sharma
https://onecompiler.com/javascript/3zqzyu2g4
http://localhost:3000/
https://www.codingame.com/clashofcode/clash/report/3342454a92e4c660d772438bac8b2ef73de3c8f
https://react.dev/learn/thinking-in-react
https://dapp-world.com/course/introduction-to-solidity-Ynws/working-of-traditional-dapps-compared-to-dapps/reading
http://www.google.com
https://www.google.com
http://google.com
https://google.com
http://www.google.com/
https://www.google.com/
http://google.com/
https://google.com/
http://www.google.com/index.html
https://www.google.com/index.html
http://google.com/index.html
https://google.com/index.html
";
RegexOptions options = RegexOptions.Multiline | RegexOptions.IgnoreCase;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx