import re a = '''asdfsafhellopass: 234455 worldafdsf ''' b = re.findall('hello(.*?)world',a) c = re.findall('hello(.*?)world',a,re.S | re.M) print 'b is ' , b print 'c is ' , c
b is []c is ['pass:\n 234455"\n aaa\n aawaw\n ']python