const regex = /title=".*(title="(.*.)">)/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('title=".*(title="(.*.)">)', 'g')
const str = `<div id="video_6003150" class="thumb-block"><div class="thumb-inside"><div class="thumb"><a href="/video6003150/pure_mature_janet_mason"><img src="https://cdn77-pic.xvideos-cdn.com/videos/thumbs169l/03/4b/22/034b224b0f77b7260aa8d6c44b49cb69/034b224b0f77b7260aa8d6c44b49cb69.5.jpg" data-idcdn="10" data-videoid="6003150" id="pic_6003150"><div class="videopv" style="display: none;"><a href="https://www.xvideos.com/video6003150/pure_mature_janet_mason"></a><div class="progress" style="display: none;"><div class="bar" style="width: 100%;"></div></div></div></a></div><button class="watch-later init-ok" title="Ver después"><span class="icon-f icf-clock"></span></button><a class="icon-f icf-check-circle icf-white-fill prof-verified-tick" title="Modelo verificada" href="/verified/videos"></a></div><div class="thumb-under"><p><a href="/video6003150/pure_mature_janet_mason" title="Pure Mature Janet Mason">Pure Mature Janet Mason</a></p><p class="metadata"><span class="bg"><span class="duration">7 min</span><a href="/channels/puremature"><span class="name">Pure Mature</span></a><span><span class="sprfluous"> - </span> 9,7M <span class="sprfluous">Vistas</span></span><span class="sprfluous"> - </span></span></p></div></div>`;
// 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