Bora Sabrioglu wrote:
fred rosenberger wrote:
[\[\]]
does not compile. (since "strings and metacharacters don't mix too well".)
Thats why you need to escape them :
What do you mean "does not compile"? it's not being compiled. It is a regular expression. it stands alone. I've even tested it using the Regex Coach.
Of course, I am being hyper-literal here. the OP asked for "the regex". Not "how do I write a regex in a
java program that does this".
To beat a dead horse: There is a difference between "the regex" and "how the regex must be represented in a java program".
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors