You need to find in the text some text that is between two characters (for example, "@")
templateTest = 'ddddffs@rusjjd@sdsvvv@xcvdfb @' simvol = '@' def findReplasement(sourse, start, end): regular = re.compile('%a(.*?)%b' %(start,end), re.IGNORECASE) result = regular.findall(sourse) return result x = findReplasement(templateTest, simvol,simvol) print(x) But in this case, an error is issued:
ValueError: unsupported format character 'b' (0x62) at index 8
At the same time, if you do not use variables, then everything works:
regular = re.compile('@(.*?)@', re.IGNORECASE) ['rusjjd', 'xcvdfb']
Where is the mistake?
start + '(.*?)' + end? - splash58%conversion typeb- Sour Sourse