I am trying to find a string that may contain brackets or other characters that cannot be interpreted as simple strings.
def findstring(string, text): match = re.search(string, text)
I do not manage the string because it is derived from another module. My problem is that the string may contain "xyz" " , which leads to an error indicating the presence of inconsistent parentheses.
I already tried this without success
match = re.search(r'%s' % string, text)
source share