use strict;
my $str = '<p><em>ขอขอบคุณข้อมูลจาก <a href="https://www.facebook.com/CrewabsCabincrew/photos/a.163266007065328.35057.162290157162913/981295968595657/?type=3">เฟซบุ๊ก Crewabs Cabincrew</a></em></p>
<script type="text/javascript"></script>asdasd
asdasdasd
asdad
<script type="text/javascript">// <![CDATA[
(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/th_TH/sdk.js#xfbml=1&version=v2.3"; fjs.parentNode.insertBefore(js, fjs);}(document, \'script\', \'facebook-jssdk\'));
// ]]></script>
<div class="fb-post" data-href="https://www.facebook.com/CrewabsCabincrew/photos/a.163266007065328.35057.162290157162913/981295968595657/?type=3" data-width="500">
<div class="fb-xfbml-parse-ignore">
<blockquote cite="https://www.facebook.com/CrewabsCabincrew/photos/a.163266007065328.35057.162290157162913/981295968595657/?type=3">
<p>จากใจแอร์สาวบนไฟล์ทที่โดนหนุ่มรถไฟจีบด้วยมุก"ระเบิด"กรณีหนุ่มรถไฟ แซวแอร์ไทยไลอ้อน อยากขอพื้นที่ชี้แจงให้ลูกเรือสาวในไ...</p>
Posted by <a href="https://www.facebook.com/CrewabsCabincrew/">Crewabs Cabincrew</a> on <a href="https://www.facebook.com/CrewabsCabincrew/photos/a.163266007065328.35057.162290157162913/981295968595657/?type=3">3 พฤศจิกายน 2015</a></blockquote>
</div>
</div>
</div>
</div>';
my $regex = qr/<script[^>]+>[\s|\S]*('facebook-jssdk'\)\);
\/\/ ]]><\/script>)/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