use strict;
my $str = 'BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:1. Bundesliga
X-WR-TIMEZONE:Europe/Berlin
X-WR-CALDESC:iCal-Spielplan mit allen Spielen der 1. Bundesliga 2013-2014 -
gratis abonnieren!
BEGIN:VEVENT
DTSTART:20150226T200500Z
DTEND:20150226T220500Z
DTSTAMP:20150227T073355Z
UID:jmgapu2jbqhsesbpjlfc495c90@google.com
CREATED:20141216T183608Z
DESCRIPTION:Europa League\\, Zw.\\n\\nhttp://www.fussball-spielplan.de
LAST-MODIFIED:20150226T221219Z
LOCATION:
SEQUENCE:3
STATUS:CONFIRMED
SUMMARY:Sporting Lissabon - VfL Wolfsburg (0:0)
TRANSP:TRANSPARENT
END:VEVENT
BEGIN:VEVENT
DTSTART:20150226T180000Z
DTEND:20150226T200000Z
DTSTAMP:20150227T073355Z
UID:uorcsvdsc24f37frgm36f3sfak@google.com
CREATED:20141216T164808Z
DESCRIPTION:Europa League\\, Zw.\\n\\nhttp://www.fussball-spielplan.de
LAST-MODIFIED:20150226T200016Z
LOCATION:Borussia-Park\\, Mönchengladbach
SEQUENCE:3
STATUS:CONFIRMED
SUMMARY:Bor. Mönchengladbach - FC Sevilla (2:3)
TRANSP:TRANSPARENT
END:VEVENT
BEGIN:VEVENT
DTSTART:20150225T194500Z
';
my $regex = qr/^DTSTART:(.+)$/mp;
if ( $str =~ /$regex/g ) {
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