human
regex to get all text outside of brackets
assistant
Here is some code to use a regex to get all text in a string `example_str` that is not surrounded by square brackets

re.findall('(.*?)(?:\\[.*?\\]|$)', example_str)

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.