using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^(https?:\/\/)?([а-я0-9_-]{1,32}|[a-z0-9_-]{1,32})\.([а-я0-9_-]{1,8}|[a-z0-9_-]\S{1,8})$";
string input = @"/********************** yes *****************/
http://yandex.ru
http://asdasd.ru
sdfsdf.ru
http://sdfsdf.ru/sadasds-sadsad/sadsad
http://sdfsdf.ru/sadasds-sadsad/sadsad?page=2
http://sdfsdf.ru/sadasds-sadsad/sadsad?page=2&other=1
sdfsdf.ru/sadasds-sadsad/sadsad?page=2&other=1
http://sdfsdf.ru/sadasds/sadsad?page=2&other=1
https://regex101.com/r/tM7Pmr/1
http://regexpres.narod.ru/calculator.html
http://regexpres.narod.ru/calculator.htm
http://regexpres.narod.ru/calculator.php
http://regexpres.narod.ru/index.php
http://regexpres.narod.ru/index
https://jsfiddle.net/3b0khwhasd6/
https://lenta.ru/articles/2017/03/06/ruvlogs/
https://www.youtube.com/watch?v=PDxVcTWVIck
www.youtube.com/watch?v=PDxVcTWVIck
https://zakon.ru/blog/2017/03/06/delo_o_denezhnyh_generatorah_i_udobnom_sude__p-v_protiv_ikea_opredelenie_skgd_vs_ot_17012017_36-kg16
https://zakon.ru/konstitucionnyj_sud_rf
zakon.ru/blog/2017/03/06/delo_o_denezhnyh_generatorah_i_udobnom_sude__p-v_protiv_ikea_opredelenie_skgd_vs_ot_17012017_36-kg16
https://zakon.ru/konstitucionnyj_sud_rf
/********************** not *****************/
4234czxc
sdfsdf
sdsad.rturturturt/fsdfsd@sd";
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