Bash's [[ builtin provides various extensions and improvements, include the regex-matching [[ str =~ regex ]].
For other shells, we can wrap it up like echo 'str' | grep -o 'regex' and send it to an array (emulated or shell native), just like bash uses BASH_REMATCH.
Bash's
[[
builtin provides various extensions and improvements, include the regex-matching[[ str =~ regex ]]
.For other shells, we can wrap it up like
echo 'str' | grep -o 'regex'
and send it to an array (emulated or shell native), just like bash usesBASH_REMATCH
.