Java regex library with recursion support

守給你的承諾、 提交于 2019-12-11 10:28:08

问题


I am looking for a Java regexp lib with support for recursion, like:

"<a+(?0)>"

JDK does not support it, ORO does neither.

Anyone knows about such?

Thanks, Ondra

Edit: See http://www.php.net/manual/en/regexp.reference.recursive.php

And I need it for this expression:

(?:mUi)^/--++ *+(.*)(?: *(?<= |^)\\.((?:\\([^)\\n]+\\)|\\[[^\\]\\n]+\\]|\\{[^}\\n]+\\}|<>|>|=|<){1,4}?))?$((?:\\n.*+)*)(?:\\n(?0)|\\n\\\\--.*$|\\z)


回答1:


The Stevesoft Pat library has some recursive-matching capability (documented here), but that feature probably isn't as useful as you expect it to be. If recursive matching is that important to you, you should probably be using a real parser instead of regexes.




回答2:


The answer is: There's none. I could possibly modify the JDK's java.util.regex.



来源:https://stackoverflow.com/questions/2010469/java-regex-library-with-recursion-support

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!