use strict;
my $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';
my $regex = qr/^[^\S\r\n]+artist:[^\S\r\n]*(.*)/mp;
if ( $str =~ /$regex/ ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
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 Perl, please visit: http://perldoc.perl.org/perlre.html