import re
regex = re.compile(r"^(?<!\) end).*?\(([\x00-\x27\x2A-\x7F]+?)\) end", flags=re.MULTILINE)
test_str = "There are some other sentences before (some otherwords which I am not interested in) all these.This is a sample string (something which I am interested in) end. This is another repeated string (with some otherwords) end."
subst = ""
result = regex.sub(subst, test_str)
if result:
print(result)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html