using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @/
^https:\/\/(?:www\.)?kuula.co\/share\/(?:[A-Za-z0-9]+\/)?(?:collection\/)?([A-Za-z0-9]+)(\?.*)?$
/;
string input = @"https://kuula.co
https://kuula.co/about
https://kuula.co/post
https://kuula.co/share
https://kuula.co/share/39u4$
https://kuula.co/post/7qQZ7
https://kuula.co/post/7qQZ7/collection/7lPZ8
http://kuula.co/share/7qQZ7
https://kuula.co/share/7qQZ7
https://kuula.co/share/collection/7lPZ8
https://kuula.co/share/7qQZ7?fs=1&abc=10
https://kuula.co/share/7qQZ7/collection/7lPZ8
https://kuula.co/share/collection/7lPZ8?vr=0
https://www.kuula.co/share/7qQZ7?abc=1
https://another-page.net/share/7qQZ7
https://kuula.co.another-page.com/share/7qQZ7";
RegexOptions options = RegexOptions.Multiline;
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