匹配方括号的正则表达式是什么? [英] What's the regular expression that matches a square bracket?
本文介绍了匹配方括号的正则表达式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个与方括号 [
匹配的正则表达式.我还没有找到.我想我尝试了所有的可能性,但没有找到合适的.什么是有效的正则表达式?
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.
这篇关于匹配方括号的正则表达式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文