use strict;
my $str = '2017-09-18 920.0100 922.0800 910.5999 915.0000 1294800
2017-09-15 924.6599 926.4899 916.3599 920.2899 2505400
2017-09-14 931.2500 932.7700 924.0000 925.1099 1397600
2017-09-13 930.6599 937.2500 929.8599 935.0900 1102600
2017-09-12 932.5900 933.4799 923.8610 932.0700 1134400
2017-09-11 934.2500 938.3800 926.9199 929.0800 1267000
2017-09-08 936.4899 936.9899 924.8800 926.5000 995100
2017-09-07 931.7299 936.4099 923.6199 935.9500 1212700';
my $regex = qr/[\s\S]{1,200}(?:\v|$)/p;
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