I'm looking fo an elegenat way to split a string by multiple delimiters and keep the delimiters at which the string got splitted.
Example:
input_str = 'X < -500 & Y > 3000 / Z > 50'
split_str = re.split("and | or | & | /", input_str)
print split_str
>>> ['X < -500', ' Y > 3000', 'Z > 50']
What I want so get for split_str
would be:
['X < -500', '&', ' Y > 3000', '/', 'Z > 50']