use strict;
my $str = '--font-heading: {{ settings.header_font_1_1.family }};
--font-standard: {{ settings.general_font_1_1.family }};
--body-font-size: {{settings.body_font_size}}px;
--font-small: 14px;
--font-medium: 17px;
--font-bold: 300;
--size-h1: {{settings.heading_size_1}}px;
--size-h2: {{settings.heading_size_2}}px;
--size-h3: {{settings.heading_size_3}}px;
--size-h4: {{settings.heading_size_4}}px;
--size-h5: {{settings.heading_size_5}}px;
--size-h6: {{settings.heading_size_6}}px;
--top-font-size: {{settings.top_bar_size}}px;
--product-font-size: {{settings.product_title_size}}px;
--product-price-size: {{settings.product_price_size}}px;
--footer-size: {{ settings.footer_font_size }}px;
{% comment %} --home-title-font-size: {{settings.home_title_size}}px; {% endcomment %}
--product-detail-title-size: {{settings.product_detail_title_size}}px;
--font-icon : 20px;
--font-small-icon: 21px;
';
my $regex = qr/{% comment %}.*{% endcomment %}/msp;
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