function extractImageUrls(htmlString) {
const imageUrls = [];
// Regex to find tags and capture the src attribute content
// Note: For robust HTML parsing, a DOM parser is generally recommended.
// This is for simple cases or learning regex application.
const imgRegex = /
]+src="([^"]+)"/g;
let match;
while ((match = imgRegex.exec(htmlString)) !== null) {
if (match[1]) {
imageUrls.push(match[1]);
}
}
return imageUrls;
}
// Example:
// const html = '

Some text
';
// console.log(extractImageUrls(html)); // ["image1.jpg", "/assets/image2.png"]