匹配方括号的正则表达式是什么?

问题描述:

我想要一个与方括号 [ 匹配的正则表达式.我还没有找到.我想我尝试了所有的可能性,但没有找到合适的.什么是有效的正则表达式?

I want a regex that matches a square bracket [. I haven't found one yet. I think I tried all possibilities, but haven't found the right one. What is a valid regex for this?

在方括号前使用反斜杠 \ 怎么样.通常方括号匹配一个字符类.

How about using backslash \ in front of the square bracket. Normally square brackets match a character class.