$string = "a:b::c d"; @patterns = (':','::','\s+'); my $re = join '|', sort { length $b <=> length $a } @patterns; @fields = split /$re/, $string; print "Got '$_'\n" for @fields; __DATA__ Got 'a' Got 'b' Got 'c' Got 'd'