Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想匹配以下字符串:
window.universal = { yada yada ydada..... };
以下返回第一行。我也需要下两个
re.search(r'.*window.universal.*', content).group(0)
我累了 re.MULTILINE,\s
.*
试试这个:
re.search(r'window.universal = {.*?};',content,re.DOTALL).group(0)
您可以使用此正则表达式:r'(?s).*pattern.*'
r'(?s).*pattern.*'
re.M
re.S