I want to match a following string:
window.universal = {
yada yada ydada.....
};
The following return the first line. I need next two as well
re.search(r'.*window.universal.*', content).group(0)
I tired re.MULTILINE, \\s
.*
will give you almost everything with dotall. try this:
re.search(r'window.universal = {.*?};',content,re.DOTALL).group(0)
You can use this regex: r'(?s).*pattern.*'
re.M
(multi-line) <<< we don't need this option re.S
(dot matches all)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.