Easy way to convert regex to a java compatible regex?

Posted by beagleguy on Stack Overflow See other posts from Stack Overflow or by beagleguy
Published on 2010-05-31T20:14:03Z Indexed on 2010/05/31 20:23 UTC
Read the original article Hit count: 243

Filed under:

hi all 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 double escape that question mark to //?

like so:

"(forumdisplay.php\\?.*page=%CURRENTPAGE%)";

is there a function I can use to do that automatically? or would I need to change all my regexes over to work with the java regex engine?

thanks

© Stack Overflow or respective owner

Related posts about java