import re
print(re.findall(r"[A-Z]+|\d+", "ABCAPITAL23JAN140CE"))
I have a string 'ABCAPITAL23JAN140CE'. This is the symbol for an option traded on stock exchange. ABCAPITAL part of the string is the company name. 23 is year 2023. JAN is for month. 140 is the strike price and CE is the type of the option.
All these components can vary for different options.
I need a function such that pieces_of_string = splitstring('ABCAPITAL23JAN140CE')
where
pieces_of_string = ['ABCAPITAL', 23, 'JAN', 140, 'CE'] is returned
how do I do that?
how do I breakdown a string in multiple components