perl -e '$str = "1 2=3 4=5"; print "$str\n"; $str =~ m/(\w+[\w\s]*=\w+)(?:\s)*/g; print "$_\n" foreach @$0;' 1 2=3 4=5 1 2=3 4=5