import re
regex = re.compile((r"<script[^>]+>[\s|\S]*('facebook-jssdk'\)\);\n"
r"\/\/ ]]><\/script>)"))
test_str = ("<p><em>ขอขอบคุณข้อมูลจาก <a href=\"https://www.facebook.com/CrewabsCabincrew/photos/a.163266007065328.35057.162290157162913/981295968595657/?type=3\">เฟซบุ๊ก Crewabs Cabincrew</a></em></p>\n"
"<script type=\"text/javascript\"></script>asdasd\n"
"asdasdasd\n"
"asdad\n\n"
"<script type=\"text/javascript\">// <![CDATA[\n"
"(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'));\n"
"// ]]></script>\n"
"<div class=\"fb-post\" data-href=\"https://www.facebook.com/CrewabsCabincrew/photos/a.163266007065328.35057.162290157162913/981295968595657/?type=3\" data-width=\"500\">\n"
"<div class=\"fb-xfbml-parse-ignore\">\n"
"<blockquote cite=\"https://www.facebook.com/CrewabsCabincrew/photos/a.163266007065328.35057.162290157162913/981295968595657/?type=3\">\n"
"<p>จากใจแอร์สาวบนไฟล์ทที่โดนหนุ่มรถไฟจีบด้วยมุก\"ระเบิด\"กรณีหนุ่มรถไฟ แซวแอร์ไทยไลอ้อน อยากขอพื้นที่ชี้แจงให้ลูกเรือสาวในไ...</p>\n"
"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>\n"
"</div>\n"
"</div>\n"
"</div>\n"
"</div>")
match = regex.search(test_str)
if match:
print(f"Match was found at {match.start()}-{match.end()}: {match.group()}")
for group_num, group in enumerate(match.groups(), start=1):
print(f"Group {group_num} found at {match.start(group_num)}-{match.end(group_num)}: {group}")
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 Python, please visit: https://docs.python.org/3/library/re.html