According to REGEX, * is only a special character when followed by a character set.
Code:
^* # Match any line starting with *, note it is not escaped.
[a-zA-z]* # Here the * has the special meaning 0 or more duplicates of the char set a-z and A-Z
Code:
sed 's/[\* [[|\*\* [[] (.*)\]\]/\1/g'
Yo have specifoed a back-reference without escaping the ( or ). To do that run sed with the -r option or escape the ( and ).
Code:
sed -r 's,^[a-z]*(.*),\1,' # or
sed 's,^[a-z]*\(.*\),\1,'
For your example, I could only get it to work with two substitute command:
Code:
echo -en '* [[hello world1]]\n** [[hello world2]]\n' | sed -e 's,^[* []*,,' -e 's,\]\+,,'
Or using the -r option to SED:
Code:
echo -en '* [[hello world1]]\n** [[hello world2]]\n' | sed -re 's,^[* []*,,' -e 's,\]+,,'
Use one substitute command:
Code:
echo -en '* [[hello world1]]\n** [[hello world2]]\n' | sed -r 's,^[* []*(.*)\]\],\1,'
Hope it helps.