const regex = /(href=\")(.*?)(\.*?">)(.*?)(\*?<\/a>.*?.small">)([0-9]+)(.*?">)([0-9]+)(.*?strong>)([0-9]+ €) (.*[0-9].br>)(.*?)(\<br>)/s;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(href=\\")(.*?)(\\.*?">)(.*?)(\\*?<\\\/a>.*?.small">)([0-9]+)(.*?">)([0-9]+)(.*?strong>)([0-9]+ €) (.*[0-9].br>)(.*?)(\\<br>)', 's')
const str = `<section class="rbr-aditem-main ad-listitem-main">
<h2><a class="ad-title" href="/anzeigen/s-anzeige/sofort-suhe-wohnung/353529866-203-16331">Sofort suhe Wohnung</a></h2>
<p>Wegen Wasserschaden sucht Ehepaar 2-3 Zimmerwohnung in Höchst und Umgebung ab sofort. Bis 750€ warm.</p>
<p>
<span class="badge-attribute rbr-tag rbr-tag-small">2 Zimmer</span>
<span class="badge-attribute rbr-tag rbr-tag-small">50 m²</span>
</p>
</section>
<section class="rbr-aditem-details ad-listitem-details">
<strong>750 € VB</strong>
<br>
65929<br>
Unterliederbach<br>
</section>
<section class="rbr-aditem-addon ad-listitem-addon">
Heute, 23:36</section>
</article>
</li>
<li class="ad-listitem lazyload-item ">
<article class="rbr-aditem">
<section class="rbr-aditem-image ad-listitem-image">
<div data-href="/anzeigen/s-anzeige/altbau-im-nordend/353505098-203-4303" data-imgsrc="http://i.ebayimg.com/00/s/MTAyNFg3Njg=/z/CYIAAOSw~gRV13uh/\$_9.JPG" data-imgtitle="Altbau im Nordend Frankfurt (Main) - Nordend Vorschau" class="rbr-imagebox srpimagebox"></div>
</section>`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
if ((m = regex.exec(str)) !== null) {
// 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