use strict;
my $str = '
General Information
Brand:
Whirlpool
Model name:
PACW9HP
Type:
On/Off
Construction Type:
Free-Standing
Number of Speeds:
7
Mode
Cooling:
Yes
Heating:
Yes
Antibacterial Filters:
Yes
Ionization:
Yes
Sleep Function:
Yes
Conditioner Features
Recommended Area:
25 - 30 m²
Capacity Cooling (BTU):
9000
Capacity Heating (BTU):
8500
Capacity Cooling (W):
3000
Capacity Heating (W):
2000
Air Flow:
350 m³/h
Indoor Noise Level:
65
HEPA Filter:
Yes
Compressor
Refrigerant:
R410A
Type of Compressor:
Rotary
Energy Rating
Energy Efficiency Class:
A+
Remote Control
Remote Control:
Yes
Timer on / off:
Yes
Power
Power from:
Network
Voltage:
200-240 V
Cord Length:
1.2 m
Color
Color:
White
Dimensions
Dimensions (W x H x D):
448 x 743 x 400 mm
Weight
Weight:
31 kg
Warranty
Warranty:
36 Months
';
my $regex = qr/^\s+$/mp;
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