import retext = "3x130-140k-ZZ-ABC"m = re.search(r"^.*?(?=-[A-Za-z])", text)if m: print(m.group())
Standard input is empty
3x130-140k
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!