I am trying to perform a split similar the following:
println "Hello World(1)".split("W");
Output:
[Hello , orld(1)]
I want to perform this split:
println "Hello World(1)".split("(");
But I see:
Caught: java.util.regex.PatternSyntaxException: Unclosed group near index 1 (
Is there a way I can escape this parentheses? Any help is appreciated.
println "Hello World(1)".split("\\(");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With