[vox-tech] regex help - matching literal []

Peter Jay Salzman p at dirac.org
Fri Apr 28 13:07:16 PDT 2006


Hi all,

In Java, I'd like to match:

\[.*\]

where \[ and \] are literal square brackets.  In other words, I'd like to
match things like:

[3] in "foo[3]"
[1][10] in "bar[1][10]"

However, the compiler complains when I escape the square brackets with a
backslash.  For some reason \[ doesn't match a literal [.

What is the regex that matches this?

Thanks,
Pete


More information about the vox-tech mailing list