import re
text = 'this is a text'
try:
found = re.search('is(.+?)text', text).group(1)
except AttributeError:
# AAA, ZZZ not found in the original string
found = '0 wtitle' # apply your error handling
found
=> a
import re
text = 'this is a text'
try:
found = re.search('is(.+?)text', text).group(1)
except AttributeError:
# AAA, ZZZ not found in the original string
found = '0 wtitle' # apply your error handling
found
=> a