regex - StackOverflowError - Java -


i want remove multi-line comments java code, i'm using following regex @ moment causing stackoverflowerror.

string regexmultiline = "(?<!\"/)(/\\*([^*]|[\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+/)";

exception in thread "main" java.lang.stackoverflowerror @ java.util.regex.pattern$grouphead.match(pattern.java:4569)

i'm using above regex following code:

content = content.replaceall(regexmultiline,"");

i want remove commented out code in file. there instances there "//* not start of comment don't want removed.

how can rework regex doesn't cause issue?

presumably program doesn't need lot of total memory (one source file can't large). have tried increasing stack size using -xss123m (where 123 can whatever value need)? assuming regex works (have tried on few simple test cases) , it's having trouble on larger file, i'd suggest testing increases stack size , see if there's point within reason allows finish.


Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -