I have to split a loooong filename with several delimiters (e.g. "AA_BB1234_CC123456789_2020-01-31_001.xml) into bits in order to create a new name from it, using the date-part and the current filenumber at the end. By pure chance I found out that
data = re.split(r'[_-.], filename)
throws a "bad character range" error, but if I change the order to hyphen, underscore, dot, it works just fine:
data = re.split(r'[-_.]', filename)
Why is that?