1, .*
Code:
import re
str = 'a111a222a'
pattern = re.compile('a.*a')
items = re.findall(pattern, str)
for item in items
print item
output:
a111a222a
2, .*?
Code 1
import re
str = 'a111a222a'
pattern = re.compile('a(.*?)a')
items = re.findall(pattern, str)
for item in items:
print item
output:
111
Code 2
pattern = re.compile('a(.*?)a')
str = 'a111a222a333a'
items = re.findall(pattern, str)
for item in items:
print item
output:
111
,333