use strict;
my $str = 'Amount
2144-PL
1XL 2XL 3XL
2144-
PL Navy Blue 2 2 2 6 $11.50 $69.00
ETK-2097K-PL PLUS-TOP - BACK BUTTON TUNICS 95% RAYON 5% SPANDEX MADE IN USA
1XL 2XL 3XL
Black 2 2 2 6 $12.00 $72.00
Teal 2 2 2 6 $12.00 $72.00
ETK-2197-SW-
1XL 2XL 3XL
PL ETK-
2197- H.Grey/Burgu… 2 2 2 6 $14.00 $84.00
Off-White/Black 1 1 1 3 $14.00 $42.00
ETK-2143 Tops - 95% RAYON 5% SPANDEX MADE IN USA
S M L
Heather Grey 2 2 2 6 $10.50 $63.00
Royal Blue 2 2 2 6 $10.50 $63.00
Ruby Red 2 2 2 6 $10.50 $63.00
ETK2186-GD- Tops-Stripe Solid-95% Rayon 5% Spandex Made in USA
PL
1XL 2XL 3XL
Burgundy/Bur… 2 2 2 6 $11.00 $66.00
Ivory/Black 2 2 2 6 $11.00 $66.00
2139 - WP-PL PLUS TOP -95% RAYON 5% SPANDEX MADE IN USA
1XL 2XL 3XL
As Shown 2 2 2 6 $9.50 $57.00
ETK-2228
S M L
ETK-
2228 Off-White/Black 2 2 2 6 $9.50 $57.00
ETK-2149-PL
1XL 2XL 3XL
ETK-
2149- Taupe 2 2 2 6 $11.50 $69.00
BACK
ORDERED
White 2 2 2 6 $11.50 $69.00
Sub';
my $regex = qr/^[\w\s./-]*(?:\s\d+){4}(?:\s\$\d+\.\d+){2}$/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