n [55]: body
Out[55]: '\n<script type="text/_javascript_">\n\t\tfunction sogouShow(){}\n\t\tfunction sosoShow(){}\n\t\t</script>\n\n\t\t<div class="loginGray" id="loginGray">\n\t\t\t<div id="loginGrayIcon" class="fr">\n\t\t\t\t<a target="_self" href="" class="login" id="loginGrayLayout" _onclick_="userLogin();" bossZone="onekey"></a>\n\t\t\t</div>\n\t\t\t<div id="dingyueGrayIcon" class="fr">\n\t\t\t\t<a href="" class="dingyue" target="_blank" bossZone="booking"></a>\n\t\t\t</div>\n\t\t\t<div id="mailGrayIcon" class="fr">\n\t\t\t\t<a href="" class="mail" target="_blank" bossZone="qmail"></a>\n\t\t\t</div>\n\t\t\t<div id="qzoneGrayIcon" class="fr">\n\t\t\t\t<a href="" class="qzone" target="_blank" bossZone="qzone"></a>\n\t\t\t</div>\n\t\t\t<div id="weiboGrayIcon" class="fr">\n\t\t\t\t<a href="" class="weibo" target="_blank" bossZone="weibo"></a>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="loginGray undis" id="loginedGray">\n\t\t\t<div id="loginGrayIconLogin" class="fr">\n'
In [56]: re.findall(r'''<script type="text/_javascript_">(.*)class="weibo" target="_blank" bossZone="weibo">''',body) 非禁止转义 匹配为空
Out[56]: []
In [57]: re.findall(r'''<script type="text/_javascript_">(.*)class="weibo" target="_blank" bossZone="weibo">''',body,re.S) 禁止转义 匹配成功
Out[57]: ['\n\t\tfunction sogouShow(){}\n\t\tfunction sosoShow(){}\n\t\t</script>\n\n\t\t<div class="loginGray" id="loginGray">\n\t\t\t<div id="loginGrayIcon" class="fr">\n\t\t\t\t<a target="_self" href="" class="login" id="loginGrayLayout" _onclick_="userLogin();" bossZone="onekey"></a>\n\t\t\t</div>\n\t\t\t<div id="dingyueGrayIcon" class="fr">\n\t\t\t\t<a href="" class="dingyue" target="_blank" bossZone="booking"></a>\n\t\t\t</div>\n\t\t\t<div id="mailGrayIcon" class="fr">\n\t\t\t\t<a href="" class="mail" target="_blank" bossZone="qmail"></a>\n\t\t\t</div>\n\t\t\t<div id="qzoneGrayIcon" class="fr">\n\t\t\t\t<a href="" class="qzone" target="_blank" bossZone="qzone"></a>\n\t\t\t</div>\n\t\t\t<div id="weiboGrayIcon" class="fr">\n\t\t\t\t<a href="" ']
关于 lua 或者 ngx.re.match 有没有 python re.S 的功能。谢谢大大们帮助。