import ress = ['Hello&World','Hello','0011&World','0011']for s in ss: print(re.match('[^&]*', s).group())
Standard input is empty
Hello Hello 0011 0011
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!