using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @".*((https?)://(www\.)?twitter\.com/[^.\s]+)";
string input = @"[15:47] <bb> I'm just going to keep them coming https://twitter.com/sarahbryant_/status/791002091045130240?lang=en
[15:49] <zz> hmmmmmm test https://twitter.com/randygdub/status/525142857015762944?lang=en
[15:49] <zz> https://twitter.com/sarahbryant_/status/791002091045130240?lang=en
[15:49] <aa> Tweet: I just found this on someone's car....
[15:52] <zz> https://twitter.com/sarahbryant_/status/791002091045130240?lang=en test 3
[15:52] <aa> Tweet: I just found this on someone's car....
[15:52] <zz> test4 pls test https://twitter.com/sarahbryant_/status/791002091045130240?lang=en test 3((https?)://(www\.)?twitter\.com/[^.\s]+)";
foreach (Match m in Regex.Matches(input, pattern))
{
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