python - Regular expression match string and then next two lines -


i want match following string:

  window.universal = {     yada yada ydada.....   }; 

the following return first line. need next 2 well

re.search(r'.*window.universal.*', content).group(0) 

i tired re.multiline, \s

  • you need dotall.
  • also 2 .* give dotall.

try this:

 re.search(r'window.universal = {.*?};',content,re.dotall).group(0) 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -