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
A good start is usually to just do a "find replace all" of "\" with "\\".
You aren't really doing a change to make this work with the java regex engine. You are just having to deal with the pains of storing a regex in a Java String... You could do this in a function, but that would make more code to maintain. I would suggest doing a find replace as described above...