python get everything between two characters

# You can do this with Reg Exp
import re

s = 'asdf=5;iwantthis123jasd'
result = re.search('asdf=5;(.*)123jasd', s)
print(result.group(1))

Here is what the above code is Doing:
1. We’re using the search method from the re module.
2. We’re looking for a string that starts with ‘asdf=5;’ and ends with ‘123jasd’.
3. We’re looking for a string that has a group of characters in the middle.
4. We’re storing the result of the search in a variable called result.
5. We’re printing the first group of characters that we found.