Simplify shell-args function. replacing substring with matching-string.
also simplify the regexp in 2nd matching stage