I don't have a solution for you that I think is elegant, but you can can do something silly like
pattern.replace("[", "[[").replace("]", "]]")to do the escaping you need.