java.util.regex.PatternSyntaxException: Unmatched closing ')' : during string.split operation -


i trying perform split similar following:

string str = "({somestring 1 lot of braces , commas}),({somestring 12with lot of braces , commas})"; println str.split("}),({"); 

but see:

java.util.regex.patternsyntaxexception: unmatched closing ')' near index 0 }),({

clearly , string being treated regular expression.

is there way can escape string?

the character ( , ) , { , } special character in regexp. have escape these:

println str.split("\\}\\),\\(\\{"); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -