Subject: bug#25750: [sed] Matching square brackets

From: 林自均 <[email-masked]>
Date: Thu, 16 Feb 2017 05:11:18 +0000

Hi sed maintainers,

I want to remove the square brackets in a string:

$ echo '[1,2,3]' | sed 's/\[//g' | sed 's/\]//g'
1,2,3

And it works.

However, when I want to do it in a single sed, it does not work:

$ echo '[1,2,3]' | sed 's/[\[\]]//g'
[1,2,3]

I can manage to make it work by a weird regexp:

$ echo '[1,2,3]' | sed 's/[]\[]//g'
1,2,3

Is that a bug? If it is, I would like to spend some time to fix it.

Thanks for reading this email.

Best,
John Lin
​