capturing a group in bash ( regex MUST NOT BE QUOTED! ) $ [[ '${these}' =~ \${(.+)} ]] && echo ${BASH_REMATCH[1]} these