It's a bit of a contrived example but here goes:Say I have a variable 1.2.3.4 containing version information and need to replace the .4 at the end with .5version=1.2.3.4echo ${version%.*}.51.2.3.5    #no problemBut when I attempt to in-line the substitution with / and a % anchorecho ${version/%.*/.5}1.5Bash does a greedy substitution. Is there a way to have bash take the substitution up non-greedily so I can use substitution as a replacement for the earlier delete+append approach?
Bash parameter expansion - greedy versus non-greedy
bash;variable substitution
Not in general but easily in this case:shopt -s extglobecho ${version/%+([0-9])/}1.2.3.