use strict;
my $str = 'Jun 20, 2016 17:59:39 [0x7f16b541b700] DEBUG - Request: [192.168.1.88:54368] GET /:/timeline?ratingKey=68803&key=%2Flibrary%2Fmetadata%2F68803&state=paused&playQueueItemID=2831&time=1360507&duration=5694741 (34 live) TLS GZIP
Jun 20, 2016 17:59:39 [0x7f16b541b700] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.
Jun 20, 2016 17:59:39 [0x7f16b541b700] DEBUG - Auth: Came in with a super-token, authorization succeeded.
Jun 20, 2016 17:59:39 [0x7f16b541b700] DEBUG - Client [iqzupp52ref65urd69nng66r] reporting timeline state paused, progress of 1360507/5694741ms for guid=, ratingKey=68803 url=, key=/library/metadata/68803, containerKey=, metadataId=68803
Jun 20, 2016 17:59:39 [0x7f16b541b700] DEBUG - Play progress on 68803 \'Kung Fu Panda 3\' - got played 1360507 ms by account 1!
Jun 20, 2016 17:59:39 [0x7f16b541b700] DEBUG - [Now] User is sydvishus (ID: 1)
Jun 20, 2016 17:59:39 [0x7f16b541b700] DEBUG - [Now] Device is Chrome (Plex Web (Chrome)).
Jun 20, 2016 17:59:39 [0x7f16b541b700] DEBUG - [Now] Updated play state for /library/metadata/68803.
Jun 20, 2016 17:59:39 [0x7f16c1bff700] DEBUG - Completed: [192.168.1.88:54368] GET /:/timeline?ratingKey=68803&key=%2Flibrary%2Fmetadata%2F68803&state=paused&playQueueItemID=2831&time=1360507&duration=5694741 (34 live) TLS GZIP 4ms 276 bytes 200 (pipelined: 20)';
my $regex = qr/Request\:\s\[(?P<req_ip>\d+\.\d+\.\d+\.\d+)/p;
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