use strict;
my $str = 'Friscos #8603
8100 E. Orchard Road
Greenwood Village, Colorado 80111
2013-11-02
Table 00
Guest
1 Oysters 1/2 Shell #1
1 Crab Cake
1 Filet 1602 Bone In
1 Ribeye 22oz Bone In
1 Asparagus
1 Potato Au Gratin
$17.00
$19.00
$66.00
$53.00
$12.00
$11.50
Sub Total
Tax
$178.50
$12.94
Total
$191.44
Berghotel
Grosse Scheidegg
3818 Grindelwald
Familie R. Müller
Rech. Nr. 4572
Bar
30.07.2007/13:29:17
Tisch 7/01
NM
#ರ
2xLatte Macchiato à 4.50 CHF
1xGloki
à 5.00 CHF
1xSchweinschnitzel à 22.00 CHF
1xChässpätzli à 18.50 CHF
#ರ #ರ #1ರ
5.00
22.00
18.50
Total:
CHF
54.50
Incl. 7.6% MwSt
54.50 CHF:
3.85
Entspricht in Euro 36.33 EUR
Es bediente Sie: Ursula
MwSt Nr. : 430 234
Tel.: 033 853 67 16
Fax.: 033 853 67 19
E-mail: grossescheidegg@bluewin.ch
\'
';
my $regex = qr/(?<!\bsub )\btotal\b\D*(\d+(?:\.\d+))/mip;
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