use strict;
my $str = '2016/11/09,12:10:00,\'4355,\'4358,\'4346,\'4351,1,201
2016/11/09,12:09:00,\'4361,\'4362,\'4353,\'4355,1,117
2016/11/09,12:08:00,\'4364,\'4374,\'4359,\'4360,10,175
2016/11/09,12:07:00,\'4371,\'4376,\'4360,\'4365,590
2016/11/09,12:06:00,\'4359,\'4372,\'4358,\'4369,420
2016/11/09,12:05:00,\'4365,\'4367,\'4356,\'4359,542
2016/11/09,12:04:00,\'4379,\'1380,\'4360,\'4365,1,697
2016/11/09,12:03:00,\'4394,\'4396,\'4376,\'4381,1,272
2016/11/09,12:02:00,\'4391,\'4399,\'4390,\'4393,524';
my $regex = qr/(.*?),(.*?),'(.*?),'(.*?),'(.*?),'(.*?),(.*)/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