No meu Mac, info bash / =~ RET
diz:
An additional binary operator,
=~', is available, with the same precedence as
==' and '!='. When it is used, the string to the right of the operator is considered an extended regular expression and matched accordingly (as in regex3)).
man 3 regex
diz:
A repetition operator (
?',
*',+', or bounds) cannot follow another repetition operator. A repetition operator cannot begin an expression or subexpression or follow
^' or '|'.
Eu não vejo nenhuma documentação análoga no man 3 regex
ou info regex
do GNU regex.
Se eu remover o ?
do seu (.*?)
e fizer o seguinte, ele funcionará nos dois sistemas operacionais:
$ a='<title>coconut</title>'; [[ "$a" =~ \<title\>(.*)\</title\> ]] && echo FOUND ${BASH_REMATCH[1]}
FOUND coconut