const regex = /class="snapshot__value-current realtime-push"><span>(\d*,\d*)<span> <span class="snapshot__value-unit">EUR/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('class="snapshot__value-current realtime-push"><span>(\\d*,\\d*)<span> <span class="snapshot__value-unit">EUR', 'gm')
const str = `
</header><main class="page-content"><nav class="breadcrumb margin-top-1.00 margin-top-0.50-lg margin-top-0.00-md margin-horizontal-2.00"><ul class="breadcrumb__list"><li class="breadcrumb__item"><span class="breadcrumb__separator icon icon--arrow-double-right"></span><a class="breadcrumb__text" href="/" title="Home">Home</a></li><li class="breadcrumb__item"><span class="breadcrumb__separator icon icon--arrow-double-right"></span><a class="breadcrumb__text" href="/aktienkurse" title="Aktien">Aktien</a></li><li class="breadcrumb__item"><span class="breadcrumb__separator icon icon--arrow-double-right"></span><span class="breadcrumb__text" title="AURELIUS Aktie">AURELIUS Aktie</span></li><script type="application/ld+json">{"@context": "http://schema.org","@type": "BreadcrumbList","itemListElement": [{"@type": "ListItem","position": 1,"item": {"@type": "WebPage","@id": "/","name": "Home"}},{"@type": "ListItem","position": 2,"item": {"@type": "WebPage","@id": "/aktienkurse","name": "Aktien"}},{"@type": "ListItem","position": 3,"item": {"@type": "WebPage","@id": "/aktien/aurelius-aktie","name": "AURELIUS Aktie"}}]}</script></ul></nav><section class="page-content__container"><!--CenterColumn_1--><div class="page-content__item no-grid-container"><div class="snapshot"><script>document.addEventListener('DOMContentLoaded', function() {if(isFinnetZeroLoginCookieActive()){document.querySelectorAll('.page-content__container .snapshot').forEach(function(e) {e.classList.add('snapshot--is-zero-user');});}});</script><h1 class="snapshot__headline">AURELIUS Aktie</h1><div class="snapshot__depot-actions"><a class="snapshot__depot-add" href="/depot/watchlist.asp?isisin=DE000A0JK2A8&inTyp=1" title="Depot / Watchlist"><span class="icon icon--depot-add"></span></a></div><div id="snapshotTrading" class="snapshot__trading"><div class="snapshot__trading-buy-btn button button--success button--stretch-md"><span class="button__label">Kaufen</span></div><div class="snapshot__trading-sell-btn button button--danger button--stretch-md"><span class="button__label">Verkaufen</span></div></div><div class="snapshot__values"><span id="snapshot-value-fst-current-0" class="snapshot__value-current realtime-push"><span>22,32</span> <span class="snapshot__value-unit">EUR</span> </span><span id="snapshot-value-fst-absolute-0" class="snapshot__value-absolut`;
// 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