["string","python","substring"]
Find string between two substrings

How do I find a string between two substrings ('123STRINGabc' -> 'STRING')? My current method is like this: >>> start = 'asdf=5;' >>> end = '123jasd' >>> s = 'asdf=5;iwantthis123jasd' >>> print((s.split(start))[1].split(end)[0]) iwantthis However, this seems very inefficient and un-pythonic. What is a better way to do something like this? Forgot to mention: The string might not start and end with start and end. They may have more characters before and after.
import re s = 'asdf=5;iwantthis123jasd' result = re.search('asdf=5;(.*)123jasd', s) print(result.group(1)) # returns 'iwantthis'