use strict;
my $str = '
<script src="/js/theme.min-1.1.js"></script><script>
const labels = [
\'00:00\',\'01:00\',\'02:00\',\'03:00\',\'04:00\',\'05:00\',\'06:00\',\'07:00\',\'08:00\',\'09:00\',\'10:00\',\'11:00\',\'12:00\',\'13:00\',\'14:00\',\'15:00\',\'16:00\',\'17:00\',\'18:00\',\'19:00\',\'20:00\',\'21:00\',\'22:00\',\'23:00\',\'24:00\',];
const data = {
labels: labels,
datasets: [{
stepped:true,
label: \'Idag\',
backgroundColor: \'#357DA7\',
borderColor: \'#357DA7\',
data: [94.24,91.59,93.52,97.70,103.23,155.15,233.20,269.03,279.92,255.87,231.30,226.70,209.64,174.65,164.84,154.16,134.04,199.48,205.03,204.88,192.49,154.16,74.40,19.47,19.47]
},
{
label: \'Idag snitt\',
backgroundColor: \'#fff\',
borderColor: \'#357DA7\',
borderDash: [5, 5],
data: [167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,],
pointRadius: 0,
borderWidth: 2
}
,{
stepped:true,
label: \'Imorgon\',
backgroundColor: \'#dd4b39\',
borderColor: \'#dd4b39\',
data: [10.28,9.82,6.15,5.10,11.91,13.78,80.03,205.79,215.04,214.14,211.85,205.64,204.86,165.63,166.62,196.70,200.63,207.10,211.79,211.80,208.24,207.02,113.90,47.63,47.63]
},{
label: \'Imorgon snitt\',
backgroundColor: \'#fff\',
borderColor: \'#dd4b39\',
borderDash: [5, 5],
data: [138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,],
pointRadius: 0,
borderWidth: 2
} ]
};
const config = {type: \'line\',data: data,options: {}};
var myChart = new Chart(document.getElementById(\'myChart\'),config);
</script>';
my $regex = qr/^const labels(.*)const config = {type: 'line',data: data,options: {}};/misp;
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