/^(?=.*a)(?=.*b)(?=.*c).*d/ #### echo bacd| perl -ne '/^(?=.*a)(?=.*b)(?=.*c).*d/; print "$1 $2 $3\n";'