Handling a regex with java.util.regex
leads to a stack overflow for large strings and complicated regex (especially with |
in it).
Is there a way to handle regular expressions more defensively in Java, like
- having a non-recursive mode for regex
- throwing a catchable exception for those regular expressions (instead of a java.lang.Stackoverflow error),
or any other mechanism that does not kill my program or put it in an unrecoverable state?