use strict;
my $str = '{
"_score": 1.0,
"_index": "newsvit",
"_source": {
"content": " \\u0641\\u0647\\u06cc\\u0645\\u0647 \\u062d\\u0633\\u0646\\u200c\\u0645\\u06cc\\u0631\\u06cc: ",
"title": "\\u06a9\\u0627\\u0631\\u0647\\u0627\\u06cc \\u0642\\u0627\\u0644\\u06cc\\u0628\\u0627\\u0641 ",
"lead": "\\u062c\\u0627\\u0645\\u0639\\u0647 > \\u0634\\u0647\\u0631\\u06cc -
\\u0645\\u06cc\\u0632\\u06af\\u0631\\u062f\\u06cc \\u062f\\u0631\\u0628\\u0627\\u0631\\u0647 .",
"agency": "13",
"date_created": 1494518193,
"url": "http://www.khabaronline.ir/(X(1)S(bud4wg3ebzbxv51mj45iwjtp))/detail/663749/society/urban",
"image": "uploads/2017/05/11/1589793661.jpg",
"category": "15"
},
"_type": "news",
"_id": "2981643"
}
{
"_score": 1.0,
"_index": "newsvit",
"_source": {
"content": "\\u0645/\\u0630",
"title": "\\u0645\\u0639\\u0646\\u0648\\u06cc\\u062a \\u062f\\u0631 \\u0639\\u0635\\u0631 ",
"lead": "\\u0645\\u062f\\u06cc\\u0631 \\u0645\\u0624\\u0633\\u0633\\u0647 \\u0639\\u0644\\u0645\\u06cc \\u0648 \\u067e\\u0698\\u0648\\u0647\\u0634\\u06cc \\u0627\\u0628\\u0646\\u200c\\u0633\\u06cc\\u0646\\u0627 \\u062f\\u0631 .",
"agency": "1",
"date_created": 1494521817,
"url": "http://www.farsnews.com/13960221001386",
"image": "uploads/2017/05/11/1713799235.jpg",
"category": "20"
},
"_type": "news",
"_id": "2981951"
}
....';
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