Aliaksandr Sushkevich
Aliaksandr Sushkevich

Reputation: 12364

Stackoverflow error in regex after compiling clojure to a jar file

I have a script written in Clojure using babashka that does some text processing. It works fine if I run it with bb command. But when I compile it to a .jar file and run using java command I get java.lang.StackOverflowError.

Exception in thread "main" java.lang.StackOverflowError
    at java.util.regex.Pattern$CharProperty.match(Pattern.java:3789)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4618)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4672)
    .....

I was able to identify that the problem is caused by this \s(?=([^\"]|\"[^\"]*\")*$) regular expression. Which I use to split a string by whitespaces excluding the ones inside quoted strings like that ("a string that is not splitted").

How do I need to update that regex so it would work in Java after compilation to a .jar file?

Upvotes: 1

Views: 150

Answers (0)

Related Questions