I have a regex defined in Python/Ruby/PHP that is like this
\"(forumdisplay.php\\?.*page=%CURRENTPAGE%)\"
When I do it for Java, I have to
Personally I use within Eclipse the EXCELLENT plugins from the site http://www.bastian-bergerhoff.com/eclipse/features/
You will find there QuickREx for regular expression and also XPath developper plugin that I use a lot.
For QuickREx, just test you regular expression and press the button to copy it on your active editor with the good escapes characters.
It's a must, just give it a try.