const regex = /<img[^>]*?itemprop="logo"[^>]*?src="([^>"]*)"[^>]*>/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('<img[^>]*?itemprop="logo"[^>]*?src="([^>"]*)"[^>]*>', 'g')
const str = `<img itemprop="logo" src="http://igid.ua/sites/default/files/imagecache/teaser-logo/images/logo/avias_33.jpg" alt="ÐЗС ÐÐ²Ð¸Ð°Ñ ÐŸÐ»ÑŽÑ" title="ÐЗС ÐÐ²Ð¸Ð°Ñ ÐŸÐ»ÑŽÑ" class="imagecache imagecache-teaser-logo" width="150" height="111">
<img itemprop="logo" class="imagefield imagefield-field_logo" width="113" height="120" title="Салон краÑоты Феечки" alt="Салон краÑоты Феечки" src="http://igid.ua/sites/default/files/images/logo/feechki_logo_2.jpg?1409836032">`;
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