import re regex = r"\|(.+?)\|"string = "PROTEIN\\t1\\t0\\ttr|Q6ZN40|Q6ZN40_HUMAN\\t\\t-1\\t;;;;;"print(re.search(regex, string).group(1))
Standard input is empty
Q6ZN40
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!