In trying to match all multiline comments in a Java source file I run into a StackOverflow()
error. It happens when the matched comment is pretty large. I've managed to more or less pinpoint the limit to 2500 characters, but this might be specific to my environment.
I'm using the following expression to match the comments:
/<comment:((\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/))+>/mi
Is there some limit to the size of the match I should be aware of, or is there a flaw in my regex?
My stacktrace is:
|project://Sevo1/src/Volume.rsc|(985,32,<53,12>,<53,44>): StackOverflow()
at countLines(|project://Sevo1/src/Volume.rsc|(985,33,<53,12>,<53,45>))
at $root$(|prompt:///|(0,73,<1,0>,<1,73>))