const regex = /^[^\S\r\n]+artist:[^\S\r\n]*(.*)/m;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^[^\\S\\r\\n]+artist:[^\\S\\r\\n]*(.*)', 'm')
const str = `mp3 @ 0x75b225b8]Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: audio (mp3), -aid 0
[lavf] stream 1: video (mjpeg), -vid 0,
Clip info:
Release date: Songspk.LINK
album_artist: Various Artists
album: Kapoor & Sons (Since 1921)
artist: Tanishk Bagchi, Arijit Singh & Asees Kaur
composer: Amaal Mallik | Songspk.LINK
disc: 1/1
encoded_by: Lame
genre: Bollywood Music
title: Bolna - Songspk.LINK
track: 1/1
EpisodeID: Songspk.LINK
copyright: Songspk.LINK
TOPE: Amaal Mallik | Songspk.LINK
TIT1: Songspk.LINK
TIT3: Songspk.LINK`;
// 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