I would like to update code between square brackets with double quotes.
$td[blabla]="x";
to
$td["blabla"]="x";
In read is ok with -r
sed -r -e 's/\[([_a-z1-9]*)]/["\1"]/g' "test.php"
But to write is down
sed -i -e 's/\[([_a-z1-9]*)]/["\1"]/g' "test.php"
sed: -e expression #1, char 26: invalid reference \1 on `s' command's RHS
It seems that the expression is not understood, but why?
Thanks you