Certain regular expressions can consume truly impressive quantities of CPU time. I need to implement a system that controls the total amount of CPU time it will take on a task.
It seems to me that the Java Pattern/Matcher system is not designed to allow me to follow the Java conventions for interrupting execution, as there is no point in the process where the evaluation engine checks for interrupts. According to http://docs.oracle.com/javase/6/docs/api/java/lang/Thread.html, one can't call destroy; one's computations have to check for interrupts.
Am I missing some mechanism here, or should I go and find an alternative open source regular expression evaluator for which I can add a time bound?