const regex = new RegExp('(?<!\\bsub )\\btotal\\b\\D*(\\d+(?:\\.\\d+))', 'gmi')
const 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
'
`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
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 JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions