import re as regex s = 'asdf=5;iwantthis123jasd' result = regex.match('asdf=5;(.*)123jasd', s) print(result)
start = 'asdf=5;' end = '123jasd' s = 'asdf=5;iwantthis123jasd' print s[s.find(start)+len(start):s.rfind(end)]