use strict;
my $str = '#main h1 {
color: #333;
}
a {
text-decoration: none;
color: #333;
}
a:hover {
text-decoration: underline;
}
body {
margin: 0;
display: table-row;
/*vertical-align: middle;
filter: url(#blur);
background: url(\'bg.jpg\') center top no-repeat #333;
background-clip: cover;
-moz-filter: blur(20px);*/
position: relative;
}
body::before {
content:\'\';
background: url(\'bg.jpg\') center top no-repeat #333;
background-clip:cover;
background-attachment: fixed;
position: absolute;
top: 0; bottom: 0; left: 0; right: 0;
height: 100%;
width: 100%;
filter: url(#blur);
filter: blur(2px);
-webkit-filter: blur(2px);
z-index: -1;
}';
my $regex = qr/\:(\s)?(.+)[^\{](\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