Easy way to convert regex to a java compatible regex?

后端 未结 4 2090
花落未央
花落未央 2021-01-01 21:30

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

4条回答
  •  清歌不尽
    2021-01-01 22:07

    Try this online tool out https://www.regexplanet.com/advanced/java/index.html

    It takes your normal regular expression and outputs the Java-compatible string expression. Saved me tons of time converting huge regex strings myself.

    Note that not all regex expressions work in java. I've seen weird PHP validation regex that simply behaves differently in java pattern matching.

提交回复
热议问题