use strict;
my $str = '/********************** yes *****************/
http://yan-dex.ru
http://asd-asd.ru
sdf-sdf.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';
my $regex = qr/^(https?:\/\/)? #протокол
([\w-]{1,32}\.[\w-]{1,32}) #домен
[^\s@]* #любой не пробельный символ + @
$
/mxp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
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 Perl, please visit: http://perldoc.perl.org/perlre.html